how do u include php code in the add pages feature
I've created a links page on my site using the "add pages" feature in vshare. The only problem is the code you submit into the page from the admin interface lets you add php code in but it isn't parsed by php so i cant use my links script on that page. smarty {php} tags dont work either.
Basically i want to add:
Code:
<?php $aldir="/go/"; include($HTTP_SERVER_VARS['DOCUMENT_ROOT'].$aldir."display.php"); ?>
<h1>Links</h1>
<?php showtag(10); ?>
anyone know a way round this so that the php code will be parsed?
Re: how do u include php code in the add pages feature
Leki, did this work for you?
Re: how do u include php code in the add pages feature
well i came up with a work around a few days after i orginally posted, its similar to what you posted but a bit better as you get the header/footer pages which change if they are logged in or not etc. also my work around lets you use the add pages edit page feature in the admin pannel too.
so for example this is my links page.
open notepad and paste the following code into it....save it as links.php or whatever
Code:
<?php
session_start();
include("include/config.php");
include("include/function.php");
STemplate::display('header.tpl');
include("pages/links.html");
STemplate::display('footer.tpl');
?>
upload the links.php and it will display your site normally with included html.
just change the include("pages/links.html"); line to be the page you have created.
Re: how do u include php code in the add pages feature
Ok, in the admin panel, I created a page called links.html and put in some text.
Then I took your php code and created a page called links.php and uploaded it to the root directory, but none of the text in links.html is showing up in the links.php.
The links.php works as it does show all the header and footer information, I'm not sure what I'm doing wrong that the stuff from links.html isn't showing up on the php page. What did I do wrong?
Re: how do u include php code in the add pages feature
Leki, any help here appreciated as soon as you have time. Thankies!!!
Re: how do u include php code in the add pages feature
sorry its me thats wrong...just checked and infact i did it slightly different way....use the same way as said above but instead of using the pages feature just create a file with just the html code you want....call it say links.txt
example links.txt
then change your php file to point to it and it should work.
example:
Code:
<?php
session_start();
include("include/config.php");
include("include/function.php");
STemplate::display('header.tpl');
include("links.txt");
STemplate::display('footer.tpl');
?>
Re: how do u include php code in the add pages feature
just thought...if you wanted to do it like i orginally posted you could use the email template bit in admin....since this doesnt work for anything else and just creates real plain files.
so u could use "Add Email Template", fill in your details
then use for your php file the code
Code:
<?php
session_start();
include("include/config.php");
include("include/function.php");
STemplate::display('header.tpl');
include("templates/emails/links.html");
STemplate::display('footer.tpl');
?>
that way you could update the page from the admin pannel like i originally posted.
Re: how do u include php code in the add pages feature
You might want to also try it without the double quotation marks. Example:
include('include/config.php');
Instead of:
include("include/config.php");