|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Dynamic Sites and Templates
Hello again guys!
I'm still strugling along with my PHP/MySQL site and I've hit what appears to be a bit of a snag. I use a simple page as a template and call the content from the DB, however I only seem to be able to call HTML, not more PHP, am I doing something wrong? Here is the basic end of the code: PHP Code:
Does that make sense? I know I'm a bad coder (either old habits or just being new) and I know the IF/ELSE statements are seriously untidy but I cannot get the content which is held in the $content variable to display PHP, only HTML! Help! |
|
#2
|
|||
|
|||
|
Some users on other forums have suggested I try using eval() to execute this code but seems this is not recommended? Also doesn't seem to work!
|
|
#3
|
|||
|
|||
|
Out of curiosity why do you wish to get php code from a database? Could you elaborate on what it is you are trying to achieve and we might be able to give you an alternative even if we can't solve the actual problem.
-KM- |
|
#4
|
|||
|
|||
|
I'm trying to make a completely dynamic site where almost all code can be edited via a web-based admin tool. It's easier to do this if the whole thing is stored in a database.
I have thought about using frames or iframes to remedy this, purely because of the template. I'll make another page to go inside the frame. Will probably be the best idea anyway as the admin tool is in a fixed size window with no scroll bars so the iFrame could add the scroll bars I need... Hmm |
|
#5
|
|||
|
|||
|
A database isn't the only way to have dynamic content. There's no reason not to store it in a normal file and provide a way to edit the file, which can then be displayed in a separate frame or window etc.
-KM- |
|
#6
|
|||
|
|||
|
I know, the way that the site works is that there is an ID passed via the URL, eg index.php?id=1
The id refers to part of the database which then pulls the information out and creates the page. The idea is that the page can be easily edited from another webpage. If there is another way to do that I would much appreciate advice on how to do it. Plus if I change the template the whole thing changes, not just a page. This appears to be the easiest way I have found to do this, as long as I only want HTML pages |
|
#7
|
|||
|
|||
|
make sure, that e.i. $ are \$ so they will be stored correctly and displayed correctly ??
- pheifel |
|
#8
|
|||
|
|||
|
These are OK. If you look at the code on one of the pages in a web browser you can still see the PHP code, it has not been processed by the server. I have been onto the host and have learnt that this is by design, I just need to find if there is a way around it!
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Dynamic Sites and Templates |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|