SSI integration problem, I can't add my own title

Started by Özgür, April 23, 2010, 07:40:13 PM

Previous topic - Next topic

Özgür

I'm using this code.
$ssi_layers = array('html', 'body');
require_once('/public_html/forum/SSI.php');
// content
ssi_shutdown();


And i need to add title to page.

I try
global $context;
  $context['page_title'] = 'Title';
 

And
global $context;
    $context['page_title_html_safe'] = 'Title'


Before or after from requiring SSI.php. But it didn't worked anyway.
Am i missed something? :/
PS: SSI function worked fine.
So Long

Arantor

Me personally, I'd use:

<?php
require('SSI.php');
$context['page_title_html_safe'] = 'My New Title';
template_header();

echo
'page content';

template_footer();
?>
Holder of controversial views, all of which my own.


Özgür

Thanks Arantor. It's worked. That change take a hour of me but worked. (:
So Long

JBlaze

<?php
require_once(dirname(__FILE__) . '/SSI.php');

$context['page_title'] = 'Page Title';
$context['linktree'][] = array(
   
'url' => $boardurl . '/page.php',
   
'name' => 'Page Name',
);

obExit(true);

function
template_main()
{
   global
$context, $txt, $scripturl;

   echo
'This is my webpage. It is located <a href="', $scripturl, '">here</a>.';

}

?>
Jason Clemons
Former Team Member 2009 - 2012

Özgür

@ JBlaze, Thank you too. Now Linktree worked too. Last thing. It's the mark as current item in menu. How can i make a new action and control it in Subs.php ?
So Long

Arantor

New actions are added via index.php - and if you're adding a new action, you don't need to use SSI.php anyway since it's mostly managed by SMF automatically.
Holder of controversial views, all of which my own.


Özgür

Quote from: Arantor on April 24, 2010, 05:26:07 AM
New actions are added via index.php - and if you're adding a new action, you don't need to use SSI.php anyway since it's mostly managed by SMF automatically.
No Arantor, I didn't  mean that. I want to add new button in main menu. And this item (if user in the my ssi page) should be selected to current_item.
Like
if(isset($current_action)) && ($current_action == 'ssi_page')
echo 'class="current_item menu_link"';
else
echo 'class="menu_link"';

Are we have any context for adding current action ?So i need to add action in SMF Subs.php, and add context in ssi page and control it from main menu codes.
So Long

Arantor

$current_action is set based on the value of $_REQUEST['action'] which you'll see earlier in the code.

I believe you can set $_REQUEST['action'] in your code (BEFORE SSI.php is loaded) to 'mypage' or something, and then define 'mypage' => array(......) in the menu.
Holder of controversial views, all of which my own.


Advertisement: