SimplePortal

Support => English Support => Topic started by: [SAP]Francis on November 09, 2009, 09:25:58 PM

Title: Changing the linktree in pages
Post by: [SAP]Francis on November 09, 2009, 09:25:58 PM
I have created a tutorial page using the PHP code pages. However, even if I added this to the code after the global statements, it didn't work.
Code: [Select]
    $context['linktree'][1] = array(
        'url' => $scripturl . '?page=tutorials',
        'name' => 'Tutorials',
    );

I don't know what to do. It is killing me so badly. Basically I want it to show it so when I'm on this page, then show "Tutorials" with a link after the linktree, like it would do with the normal linktree.
So basically:
[link]Forum Name[/link] ยป [link]Tutorials[/link]

Thank you. :)
Title: Re: Changing the linktree in pages
Post by: Nathaniel on November 09, 2009, 09:41:48 PM
The php code in the Pages, is run from the template functions. This means that the linktree has already been displayed before your code is run, so you can't alter the linktree.

The edit below will change the linktree so that an entry is added for the page, this will happen for all pages, although you could add an if statement so that it only happens for the relevant pages.

Code: ("Find (Sources/PortalPages.php)") [Select]
    $context['page_title'] = $context['SPortal']['page']['title'];
Code: ("Replace") [Select]
    $context['linktree'][] = array(
        'url' => $scripturl . '?page=' . $context['SPortal']['page']['id'],
        'name' => $context['SPortal']['page']['title'],
    );

    $context['page_title'] = $context['SPortal']['page']['title'];
Title: Re: Changing the linktree in pages
Post by: [SAP]Francis on November 09, 2009, 09:53:43 PM
I tried adding that, then it didn't work, but it gave me a blank page on the administration page for the pages. So I reverted everything, but the blank page is still there. Help?

Error is:

Parse error: syntax error, unexpected T_IF in /*hidden*/Sources/PortalAdminPages.php on line 1

Can you attach a blank and stock PortalAdminPages.php and PortalPages.php please?
Title: Re: Changing the linktree in pages
Post by: Nathaniel on November 09, 2009, 10:08:43 PM
Did you edit the PortalAdminPages.php or the PortalPages.php file? You shouldn't have had to change anything in the PortalAdminPages.php file, so I don't see why it would be returning an error.

Can you please attach both?
Title: Re: Changing the linktree in pages
Post by: [SAP]Francis on November 09, 2009, 10:16:51 PM
I will attach both, but the problem is I think I'm too tired and edited the wrong one firstly, then reverted the changes I made from another file, which should have been the good one at the start...
Title: Re: Changing the linktree in pages
Post by: Nathaniel on November 09, 2009, 11:22:05 PM
All of the contents are on the same line, an error usually caused by a terrible editor like Notepad (under windows). Never edit any php files that you actually care about using notepad...

If you hadn't made any previous edits to those files, then upload the attached file and also a clean copy of the PortalAdminPages.php file from the SimplePortal package.
Title: Re: Changing the linktree in pages
Post by: [SAP]Francis on November 09, 2009, 11:30:12 PM
All of the contents are on the same line, an error usually caused by a terrible editor like Notepad (under windows). Never edit any php files that you actually care about using notepad...

If you hadn't made any previous edits to those files, then upload the attached file and also a clean copy of the PortalAdminPages.php file from the SimplePortal package.
I'm using Notepad2... :S
Title: Re: Changing the linktree in pages
Post by: Nathaniel on November 10, 2009, 04:46:46 PM
Did that file work?
Title: Re: Changing the linktree in pages
Post by: [SAP]Francis on November 10, 2009, 06:33:32 PM
Did that file work?
Yeah, thanks.
SimplePortal 2.3.8 © 2008-2024, SimplePortal