homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

pulling additional php from DB. is this possible?

 8:59 am on Oct 23, 2007 (gmt 0)

Is it possible to print some php into a page header in the same way that we can print html or xml?

For example:
In a content management system the user has the ability to create pages, they populate the content, the page title, meta data, and advanced users have the option to write some php which can be included with the rest of the php code in the page. All of which is stored in the database

Before declaring a doctype on the front end there are a number of php functions to gather the content for a specified page, which is then printed in the required area, wether that is in meta content or between the body tags.

Back to the original question then -
before I close my php and declare the page doctype, how do I print any additional php that may be in the DB for this page

I've tried

// IMPORTED CODE ////////////////////////////////////////////
print '?><?php '.$gotContent['CODE'].'?><?php ';

but I then see this code instead of it being absorbed as part of the php



 9:07 am on Oct 23, 2007 (gmt 0)

print '?><?php '.$gotContent['CODE'].'?><?php ';

Is it not possible to just print what you want? Why open and close many PHP tags?

Can't this do the job for you?
<?php print $gotContent['CODE'];?>



 9:19 am on Oct 23, 2007 (gmt 0)

thats what I tried at first but it just prints the content in the header, again instead of absorbing it as part of my php


 9:19 am on Oct 23, 2007 (gmt 0)

Have a look at eval() [php.net].

Remember that php is a server-side language - when you print, you're just placing content into a document to transmit to a browser - the interpretor doesn't look at it.


 9:23 am on Oct 23, 2007 (gmt 0)

that's the ticket

thanks guys

it was one of those questions which was difficult to search for answers on

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved