Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: how do u include php code in the add pages feature

  1. #1
    Join Date
    May 2007
    Posts
    588

    Default 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?

  2. #2
    Join Date
    May 2007
    Location
    Planet Earth
    Posts
    1,389

    Default

    Yes, I want to do something similar. The static pages only goes to .html and I want to create .php pages for a "contact us" form that runs on PHP. Barring making pages by hand, adding pages thru admin panel is a nice breezy touch that I'd like to be able to take advantage of, but in PHP.
    If it's not fun, stop doing it!

  3. #3
    Join Date
    May 2007
    Location
    Planet Earth
    Posts
    1,389

    Default

    Well, here's a "work around" that I came up with.

    Make any dummy page and call it anything you want...put in all the code that you want and then create the page. Then visit that .html page you just created and go to view>source and copy all the code.

    Then in your html editor like Dreamweaver or whatever you use, create a .php page and just paste in all the code you just copied from the source document.

    Upload your new .php page to where you want it to be and it should work. Mine did.
    If it's not fun, stop doing it!

  4. #4
    Join Date
    May 2007
    Location
    Planet Earth
    Posts
    1,389

    Default Re: how do u include php code in the add pages feature

    Leki, did this work for you?
    If it's not fun, stop doing it!

  5. #5
    Join Date
    May 2007
    Posts
    588

    Default 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.

  6. #6
    Join Date
    May 2007
    Location
    Planet Earth
    Posts
    1,389

    Default 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?
    If it's not fun, stop doing it!

  7. #7
    Join Date
    May 2007
    Location
    Planet Earth
    Posts
    1,389

    Default Re: how do u include php code in the add pages feature

    Leki, any help here appreciated as soon as you have time. Thankies!!!
    If it's not fun, stop doing it!

  8. #8
    Join Date
    May 2007
    Posts
    588

    Default 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
    Code:
    test
    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');
    ?>

  9. #9
    Join Date
    May 2007
    Posts
    588

    Default 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.

  10. #10

    Default 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");
    This member is now known as Sitting Out

Page 1 of 2 12 LastLast

Similar Threads

  1. How to INCLUDE pages in vshare
    By carefree in forum Template Modifications
    Replies: 3
    Last Post: 06-17-2008, 11:27 AM
  2. How To Do a PHP file Include??? Help?
    By musictvblogger in forum Installation Support
    Replies: 8
    Last Post: 06-11-2008, 05:23 AM
  3. How To Use PHP Include <?php include(''); ?>
    By scwebmaster in forum General Discussions
    Replies: 5
    Last Post: 02-21-2008, 09:12 PM
  4. search feature on all pages
    By lesansan in forum Template Modifications
    Replies: 3
    Last Post: 11-06-2007, 10:00 AM
  5. If you include ' in your heading '
    By zeffer in forum Fixed Bugs
    Replies: 7
    Last Post: 07-18-2007, 05:13 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •