SyntheticShield Posted February 21, 2012 Share Posted February 21, 2012 Is there a way to create dynamic content without the use of a Content Management System? I simply want to click on a link in my navigation menu and have that display the content in a div section and keep the content in a separate folder on the server. I didnt want to have to use a CMS to accomplish that because every other feature of it will be unused as I just simply want to display the content in a div when I click on the link. I use a simple test server on my Home PC that I use to format the articles in html from documents I have wrote in LibreOffice, so I dont really need all the features and sophistication of full blown CMS. But I also dont want a bunch of different files in my root folder if I can avoid it. I would rather keep the content in a separate folder and just pull it from there and display it on the main page when the link is clicked. Anyway, I dont know if its even possible or if its the best way, so I am open to suggestions as well. Some of the documents are quite long (like several chapters) and some are much shorter (just a few pages). Any help and ideas are much appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/257428-dynamic-content/ Share on other sites More sharing options...
Rifts Posted February 21, 2012 Share Posted February 21, 2012 yes this would be very simple to do. the html for the change-able article would be <div id="harry-potter"> <?php $myFile = "testFile.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, filesize($myFile)); fclose($fh); echo $theData; ?> </div> change the location of $myFile = "path to your file (maybe like /article/harrypotter.txt)" then just upload the article to that location! Quote Link to comment https://forums.phpfreaks.com/topic/257428-dynamic-content/#findComment-1319407 Share on other sites More sharing options...
SyntheticShield Posted February 21, 2012 Author Share Posted February 21, 2012 Oh. Well that is far, far simpler than I thought it was going to be. Ive been searching of and on for most of the day trying to find a workable solution that was not all convoluted and such and had not run across anything like that. If I could trouble you for the additional information, how would I tie that to the navigation menu? Its just a basic CSS ul/li menu with one sub level. All the web files are .php as I use includes to form the template structure if that makes a difference. My thoughts, initially were just to put the content in a file with just the basic p and h tags to make it semantically correct, call it into the div and just let the css take over from there. Thanks for the help. Quote Link to comment https://forums.phpfreaks.com/topic/257428-dynamic-content/#findComment-1319411 Share on other sites More sharing options...
Rifts Posted February 21, 2012 Share Posted February 21, 2012 Just add the link to the nav bar like you would any other link? and have the link open up a new page with that special div on it. Quote Link to comment https://forums.phpfreaks.com/topic/257428-dynamic-content/#findComment-1319413 Share on other sites More sharing options...
SyntheticShield Posted February 21, 2012 Author Share Posted February 21, 2012 Ahh, awesome. Thank you so much for your help Rifts. It is very much appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/257428-dynamic-content/#findComment-1319414 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.