SimplePortal

Customization => Custom Coding => Topic started by: mee on September 24, 2009, 03:50:26 PM

Title: Custom PHP in the middle panel
Post by: mee on September 24, 2009, 03:50:26 PM
Hello,

Excuse me, if I post this question to a wrong board. I want to ask, if it possible to make a custom page, with my own PHP but inside whole forum's main template (like heading, footers, and portal blocks on left and right)?

thanks in advance,
Michael
Title: Re: Custom PHP in the middle panel
Post by: Nathaniel on September 24, 2009, 08:34:19 PM
Yes, use the Custom Pages feature in SimplePortal 2.3.
Title: Re: Custom PHP in the middle panel
Post by: mee on September 25, 2009, 06:05:03 PM
Great, thanks a lot!
Title: Re: Custom PHP in the middle panel
Post by: mee on September 26, 2009, 06:59:48 PM
Sorry, but I still can't add a page, I get the following error:

<i>Syntax error in block code. Please check the code. </i>

I used include, to include original php file, and it didn't work either. it works with preview, but when I click "add" it gives me the same error :(


My "Include" code:

<?php
include("calc.php");
?>
Title: Re: Custom PHP in the middle panel
Post by: Nathaniel on September 26, 2009, 07:17:49 PM
Try the code below:
Code: [Select]
global $boarddir;
include($boarddir . '/calc.php');

You should never use 'relative' file paths. The $boarddir gives you the abolute filepath of your main forum directory.
Title: Re: Custom PHP in the middle panel
Post by: mee on September 26, 2009, 07:42:43 PM
ah.. at last, I understood that. All the content of "PHP" page is proccessed by "eval()" right? So I can't just do my html, then put <?php echo?> and then do my HTML again. Ok, thanks for explanation.
Title: Re: Custom PHP in the middle panel
Post by: Nathaniel on September 26, 2009, 10:25:33 PM
You can use HTML, but you have to put it in like in the examples below:

Either:
Code: [Select]
?>
HTML
<?php

or
Code: [Select]
echo 'HTML';
Title: Re: Custom PHP in the middle panel
Post by: johncccccc on October 04, 2009, 07:22:21 PM
dont mean to bump an old topic, but if your using HTML code for the custom page, why not just use a HTML custom block.

for the PHP needs you can just add another top/bottom block
Title: Re: Custom PHP in the middle panel
Post by: homer09001 on October 06, 2009, 10:04:14 AM
Sorry to dig again but im trying to include a file that is outside of the main forum directory my forum is at:

http://dth-scripts.com/Forum

and the file i wish to include is at:
http://dth-scripts.com/inc/contact.php

how can i go about including that as if i use a standard relative include i get the syntax error message?
Title: Re: Custom PHP in the middle panel
Post by: Nathaniel on October 06, 2009, 07:13:29 PM
how can i go about including that as if i use a standard relative include i get the syntax error message?

There are issues with the PHP syntax validator in SP 2.3, don't use relative paths, they don't work properly. This will be resolved in SP 2.3.1.
SimplePortal 2.3.8 © 2008-2024, SimplePortal