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");
Re: how do u include php code in the add pages feature
I tried something else in the meantime, you're gonna be proud of me since I know squat about php :) LOL
I took your code and between the lines for STemplate::display('header.tpl');STemplate::displa y('footer.tpl');, I put in my html and other php code to make a "contact us" page that runs on php. I was careful to put in the ?> statements and everything.
Worked like a charm! The header now has the login stuff on it like it should. I'll be trying the email templates thing too. That's quite ingenious.
Here's the code for extra pages that I'm using...
Create a .php page and call it whatever you want like "links.php" and put this in it:
Code:
<?php
session_start();
include("include/config.php");
include("include/function.php");
STemplate::display('header.tpl');
?>
YOUR SITE CONTENT HERE BLAH BLAH BLAH
<?php
STemplate::display('footer.tpl');
?>
Re: how do u include php code in the add pages feature
OK, now that I'm a "pro" at creating pages outside the ACP's "add pages" thingie, does anybody know how to get it so that a page can be accessed only by members? The problem is with the new RTE, I can't have <object>, <textarea> and <form> tags in it and I need to have this, especially on pages that are for members only.
Re: how do u include php code in the add pages feature
Re: how do u include php code in the add pages feature
I'm really new at this php stuff but basically by creating the php page, that will allow the added pages to function like all the other pages? I want to add a comment box just like the one on the video page. I copied the code but it won't work. I can see it on my page though.
Re: how do u include php code in the add pages feature
The comments box, I believe, is related to the user/video/group ID information on the page where it exists...like their profile, or the video or the group etc...so you might want to find a different script for that.
Re: how do u include php code in the add pages feature
Yeah..I'm working on getting a comment script now. I'll let you know how it turns out.
Re: how do u include php code in the add pages feature
I tend to agree with you.
You just saved me a bunch of time and headaches!!!
Thank you soooo much for creating this!!! 8)