Jump to content

Dynamic Content


SyntheticShield

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/257428-dynamic-content/
Share on other sites

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!

Link to comment
https://forums.phpfreaks.com/topic/257428-dynamic-content/#findComment-1319407
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/257428-dynamic-content/#findComment-1319411
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.