spikypunker Posted March 10, 2009 Share Posted March 10, 2009 Hi guys, have just embarked on making my site all dynamic, and have had the same problem which i could foresee. I've got the navbar code all stored in the db fine, and it's bringing it in in a seperate function page and then called in the main page, this is working great. I've also got a sidebar on the page which i wanted to do the same to, so went about it in the same method. However the sidebar also had PHP code in, and this code isnt being processed, just echoed on the page! So to clarify, On the page i've got a funciton call to a seperate php page with a function called "sidebar". This is called from the page then the result ECHOED. In the sidebar function there is php code which brings in from the Mysql DB, WHERE area=sidebar, and then RETURNS the result. HOWEVER (lol) in this code which is bought in from the mysql, there is also PHP code which draws from a different mysql db. So basically i want it to process the code, bring in more code, and then process it again, which i;m guessin is the problem! Is there anyway round this? Kind Regards, Chris Quote Link to comment https://forums.phpfreaks.com/topic/148743-solved-inserting-php-code-from-a-db/ Share on other sites More sharing options...
trq Posted March 10, 2009 Share Posted March 10, 2009 Why on earth are you storing code in the database? Quote Link to comment https://forums.phpfreaks.com/topic/148743-solved-inserting-php-code-from-a-db/#findComment-781023 Share on other sites More sharing options...
spikypunker Posted March 10, 2009 Author Share Posted March 10, 2009 lol! I dont know! How else would i do it? I've got a sidebar with a bunch of different <div>'s from the CSS page and then a couple of PHP sections and want to be able to change it in one place and have it go through the whole site! In the next coupla months i'm going to construct it so that the content is stored in the DB but for now, i need to instead store the sidebar and navbar in a seperate place, hence the DB! Help! Quote Link to comment https://forums.phpfreaks.com/topic/148743-solved-inserting-php-code-from-a-db/#findComment-781027 Share on other sites More sharing options...
trq Posted March 10, 2009 Share Posted March 10, 2009 Just store your sidebar and nav in a file and include it into wherever you need it. Quote Link to comment https://forums.phpfreaks.com/topic/148743-solved-inserting-php-code-from-a-db/#findComment-781030 Share on other sites More sharing options...
spikypunker Posted March 10, 2009 Author Share Posted March 10, 2009 MY GOD!! EVERYONE NEEDS TO KNOW THIS!! holy crap thats awesome lol, my webstie now rules thanks for the help! Quote Link to comment https://forums.phpfreaks.com/topic/148743-solved-inserting-php-code-from-a-db/#findComment-781044 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.