Hello and thanks for this great little CMS. I am putting together a one page website and being able to edit-in-place is a huge bonus! Looking though index.php I see a function called displaySectionContent($cnum). How is this function used to retrieve content? I see that $content[0] is filled with the main page content. Do I have to create another function to get different content to display in sections of the page or has this been done and I am missing it?
Thanks!
********* UPDATE ***************
I managed to get a "section" to display.
Below this
Code: Select all
$contentfile = $page = getSlug( $page );
$content[0] = @file_get_contents("files/$contentfile.txt");
I added this
Code: Select all
$content[1] = @file_get_contents("files/$contentfile-top.txt");
Pretty simple but now I find that the edits are not saving!
*************** SOLVED (for me at least) *******************
I modified the displaySectionContent
Code: Select all
function displaySectionContent($cnum,$slug)
{
global $cookie, $content,$contentfile;
if($_COOKIE[$cookie])
{
echo "<div id='change'><span id='$contentfile-$slug' class='editText' style='display:block'>$content[$cnum]</span></div>";
}
else echo $content[$cnum];
}
The content number ($cnum) was being used as the span id and there was no corresponding file named 1.txt. I added $contentfile as a global and created another variable ($slug). $contentfile-$slug is the name of the corresponding .txt file, which in this case is Home-top. Now the edits to the file are saved. The call to the function in default.php is
Code: Select all
<?php displaySectionContent(1,'top');?>
.