All Content in Site

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
ge0
New Member
New Member
Posts: 7
Joined: Mon Jun 19, 2006 9:28 am

All Content in Site

Post by ge0 »

I'm looking at a way of displaying all of the content in a site on a single page to facilitate the proofing of the content onces it's in the site.  I'm looking at the Google Sitemaps module/file and can see the beginnings of an easy way to do it but wondered if anyone had already done anything similar as I'm not too familiar with the API and corrrect way to load all the content for a page properly.  I've searched high and low and can't find anything similar but excuse me if it's been done.

TIA

George
ge0
New Member
New Member
Posts: 7
Joined: Mon Jun 19, 2006 9:28 am

Re: All Content in Site

Post by ge0 »

OK have solved this, so for anyone else who might be interested I have included the hacked up gsitemap code below.  Way more simple than I originally thought!

Code: Select all

<?php
#CMS - CMS Made Simple
#(c)2004 by Ted Kulp (wishy@users.sf.net)
#This project's homepage is: http://cmsmadesimple.sf.net

// Configuration:

	//setting time-zone statically
define("TZD", "+01:00");
	
// hides items which are not shown in the mnu	
define("HIDE_NONMENITEMS", false);

require_once(dirname(__FILE__)."/include.php");

	$allcontent = ContentManager::GetAllContent();
	$maxdepth = 10;
	foreach ($allcontent as $onecontent)
	{
		$depth = count(split('\.', $onecontent->Hierarchy()));
		if($maxdepth < $depth)
			$maxdepth = $depth;
			
	}


	foreach ($allcontent as $onecontent)
	{
		$depth = count(split('\.', $onecontent->Hierarchy()));
		//$rel = 1 - ($depth-1) / ($maxdepth);
		$rel = 0.7 / $depth;
		
		$rel = number_format($rel, 1, '.', '');
		
		if($onecontent->DefaultContent())
		 {
			$rel = 1;
		 }
		
		if (!$onecontent->Active())
		{
			continue;
		}

		if ($onecontent->Type() == 'separator')
		{
			continue;
		}

		if ($onecontent->Type() == 'sectionheader')
		{
			continue;
		}
		
		if (!$onecontent->ShowInMenu() && HIDE_NONMENITEMS) 
		{
			continue;
		}
		// Mod by PePiPoo
		if ( strpos($onecontent->GetURL(), $gCms->config['root_url'] ) === false )
		{
			continue;
		}
		
		echo ' <a href="' . $onecontent->GetURL()  . '">'.$onecontent->mName.'</a>'. "\n";

		$objContent = ContentManager::LoadContentFromId($onecontent->mId);
		$pagetitle = $onecontent->mName;
		$pagecontent = $objContent->GetPropertyValue('content_en');
		echo '<h1>'. $pagetitle .'</h1>';
		echo '<div class="page">'.$pagecontent.'</div>';
		
	}	
?>
photon

Re: All Content in Site

Post by photon »

Just wanted to thank you, I'm very grateful that you shared it!
It was very useful to get an overview in one page.
Post Reply

Return to “CMSMS Core”