All pastes #542795 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-06-05 22:41 UTC
rendered paste body
<?php
   
   /* The Blog Module for The Maranga Publishing System is based on the Guava Framework */

function blogmod($ret=null,$blockreq=false)
	{
		//Options
		if($ret=='head'){return 'theme';}
		if($ret=='foot'){return 'theme';}
		if($ret=='data'){return true;}
		if($ret=='theme'){return 'blogmod.php';}
		
		//Engine
		if($ret=='body'){
			
			include(get('url','data') . 'blog.xml'); //Get the Data
			$xml = new SimpleXMLElement($xmlfeed);
			
			echo '<h1>Blog</h1>';			
			
			$method = get('method');
			$parameter = get('parameter');
	
			if(!$method){ //Home Page
				foreach($xml->post as $post){
					$block='excerpt';
					$title = $post->title;
					$date = $post->date;
					$category = $post->category;
					$content_excerpt = substr($post->content,0,165);
					$content_excerpt = $content_excerpt . '...';
					include(get('url','site') . 'blogmod.php');
				}
			}
			elseif($method=='post'){ //Single Page
				foreach($xml->post as $post){
					if($post->title==$parameter){
						$block = 'single';
						$title = $post->title;
						$date = $post->date;
						$category = $post->category;
						$content = $post->content;
						include(get('url','site') . 'blogmod.php');
					}
				}
			}
			elseif($method=='category'){ //Category Links
				if(!$parameter){
					$i=0;
					foreach($xml->post as $post){
						$block = 'category';
						if(isset($categoryar)){
							if(!in_array($post->category, $categoryar)){
								$categoryar[$i] = $post->category;
							}
						}
						else{
							$categoryar[$i] = $post->category;
						}
						if(isset($categoryar[$i])){
							$category = $categoryar[$i];
							include(get('url','site') . 'blogmod.php');
						}
						$i++;
					}
				}
				else{
					foreach($xml->post as $post){
						if($post->category==$parameter){
							$block = 'excerpt';
							$title = $post->title;
							$date = $post->date;
							$category = $post->category;
							$content_excerpt = substr($post->content,0,165);
							$content_excerpt = $content_excerpt . '...';
							include(get('url','site') . 'blogmod.php');
						}
					}
				}
			}
			else{
				echo 'no query found of that nature';
			}

			include(get('url','site') . 'blogmod.php');
		}
}
function blogadmin(){
	
}
	
//blog_module.php tags


?>



in blogmod.php
<?php if($block=='excerpt'){ /*Excerpt*/ ?>
<div id="post">
	<div id="title" class="title">
		<?php $title; ?>
	</div>
	<div id="date" class="date">
		<?php get_date(); ?> - 
		<a href="<?php get_the_url(); ?>category/<?php echo $get_category;; ?>"><?php get_category(); ?></a>
	</div>
	<div id="content" class="content">
		<?php get_content(); ?><a href="<?php get_this_link(); ?>/post/<?php get_title(); ?>"><small>more</small></a>
	</div>
</div>
<?php ; } ?>

<?php if($block=='single'){ //Single Page ?>
	<div id="post">
		<div id="title" class="title">
			<?php get_title(); ?>
		</div>
		<div id="date" class="date">
			<?php get_date(); ?> - 
			<a href="<?php get_the_url(); ?>category/<?php get_category; ?>"><?php get_category(); ?></a>
		</div>
		<div id="content" class="content">
			<?php get_content(); ?>
		</div>
	</div>
<?php } ?>

<?php if($block=='list_title'){ //Title List ?>
		<div class="title_list">
			-
		</div>
<?php } ?>

<?php if($block=='category'){ //Category List ?>
	<div class="title-list">
		-<a href="<?php get_the_link(); ?>category/<?php get_category(); ?>"><?php get_category(); ?></a>		</div>
<?php } ?>