[SOLVED] displaySectionContent

Post Reply
Posts: 2
Joined: Mon Aug 06, 2012 12:44 pm

[SOLVED] displaySectionContent

Post by muskokee »

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?


********* 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;
		   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');?>
User avatar
Posts: 532
Joined: Sat Oct 30, 2010 12:23 am

Re: displaySectionContent [SOLVED]

Post by wiz »

Hello muskokee!

I'm glad you managed to figure out a solution for yourself and for the upcoming WonderCMS users that might run into this problem - thank you.
If you need any more help, you know where to find it.
Post Reply