This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Bug in custom phpTemplate

I'm using phpTemplate to run a news site (news.plu.edu). The problem that I'm having is that one of my pages is only desplaying ten items, and I can't seem to find the bug. If you visit this page (Campus News) you can see everything in action. The items in the gray box is where I need help. If more than ten items are assigned to this area, it will only show ten.

Allow me to explain how I think this should be working:

  1. page.tpl.php has a script that sends users to a different page template (see detection script below). I have verified that this is working correctly. So when a user request a page with "campus-news" in the URL they are sent to the campusnews.tpl.php file.
  2. campusnews.tpl.php has a script that grabs node items that match certain taxonomy requirements (see campusnews code below).
  3. template.php includes some custom variables for sorting term ids, these variables are used on the page templates to help filter node content (see template.php code below). Basically template.php provides campusnews.tpl.php with the term id's need to filter and show the proper content.
  4. Using flexinode I've created a custom content type called "campus news", and another called "campus news page".
  5. Within the taxonomy module I've created vocabulary and terms for categorizing campus news items by issue, and placement (see example below)
  6. Every campus news item is given taxonomy for assigning an issue date, and a placement (where it appears on the campus news page).
  7. Each campus news page is given a URL alias and an issue date.

Have I lost you yet? There might have been an easier way to do this, but I only had a week to get the site up and running. So what am I missing why am I only able to dispaly ten items in the gray box?

Detection Script in page.tpl.php. Sends users to the correct template.

// Check to see if the current page has an alias, use alias to match template
else {
	$url_real = $_GET["q"]; // Get the real URL
	$url_results = db_query("SELECT * FROM {url_alias}"); // Grab the list of aliases
	$url_alias = ""; // Initialize alias variable
	
	while ($url_data = db_fetch_object($url_results)) { 
		
		// If the the real URL matches an entry in the list of aliases
		if($url_data->src == $url_real){
			$url_alias = $url_data->dst; // Create alias to use for template check
		}
	}
	
	if ($url_alias != ""){
		
		// Split up alias information
		$arguments = explode('/', $url_alias); 

		// Issues
		if($arguments[0] == "issue"){
			// If argument 2 is empty then it's a home page
			if($arguments[2] == ""){
				include('home.tpl.php');
				return;
			}
			// News Release
			elseif($arguments[2] == "news"){
				include('news.tpl.php');
				return;
			}
			// Campus News
			elseif($arguments[2] == "campusnews"){
					include('campusnews.tpl.php');
					return;
			}
		}
		// PLU in the news
		elseif($arguments[0] == "pluinthenews"){
				include('pluinthenews.tpl.php');
				return;
		}
		// Classifieds
		elseif($arguments[0] == "classifieds"){
			include('classifieds.tpl.php');
			return;
		}
		// Events
		elseif($arguments[0] == "events"){
			include('events.tpl.php');
			return;
		}
		// Events
		elseif($arguments[0] == "archives"){
			include('archives.tpl.php');
			return;
		}
	}

News items script taken from campusnews.tpl.php (this code spits out the items for the gray box)


/* GET ITEMS
- Takes the page term id, and the termid of the desired position (feature, news item etc.)
- Returns a sorted array (by date) of node title, teaser, link, and date
*/
function getItems ($pagetid, $termtid){

// Get Items
$tax = array($pagetid, $termtid);
$operator = "and";
$result = taxonomy_select_nodes($tax, $operator);
while ($obj = db_fetch_object($result)) {
$node = node_load(array('nid' => $obj->nid));
$items[] = array('title'=>$node->title, 'description'=>$node->flexinode_13, 'extended'=>$node->flexinode_14, 'medium'=>$node->flexinode_27->filepath, 'link'=>"node/". $node->nid, 'date'=>$node->created);
}

if ($items != ''){
// Sort items by date (oldest goes to bottom)
foreach ($items as $key => $row) {
$date[$key] = $row["date"];
}
array_multisort($date, SORT_DESC, $items);

}

return $items;
}

$newsItems = getItems($pagetid, $campusnewsitemtid);

if($newsItems != ''){

foreach($newsItems as $value){

echo "

";

// If there's a medium image show it
if($value['medium'] != ''){
echo "Only local images are allowed.";
}

echo "

" . $value['title'] . "

";
echo "

". $value['description'] ."

node->body displayed first?

Hi,

I was planning on reusing node->body for my module, but it seems to get printed out before any content set in my module. I used the following two functions in my module, straight from the node.exmaple:

function course_view(&$node, $teaser = FALSE, $page = FALSE) {
$display = theme('course_display', $node);
$node->body .= $display;
$node->teaser .= $display;
$node = node_prepare($node, $teaser);
}

Simple_Access and RSS feeds

I understand that it is not possible to create a RSS feed that includes "simple-access enabled" blog entries. Am I correct ?

François-Xavier

CiviCRM install requirements

I'd like to test out CiviCRM and see what the buzz is about. I notice the requirements for CiviCRM call for PHP 4.11 or PHP 5.

However, I'm running Debian Sarge which uses PHP 4.10. I'd rather keep my Debian installation "pure" and not have to install PHP 4.11 or PHP 5 by hand. Anyone know if the Debian version of PHP 4.10 is good enough to run CiviCRM?

Problem with gallery.modul

I've just recently installed Gallery 2.0 and i've wiped my drupal installation clean to work on some integration but I'm having the following issue. I haven't seen this one reported anywhere-- so I figured I'd toss it up here to see if people have any ideas.

Using: Gallery 2.0
Drupal: 4.6.3
Gallery.Module: CVS HEAD (Updated 9/12/05)


Unable to get Gallery image block
Error (ERROR_CONFIGURATION_REQUIRED)

* in modules/core/classes/GalleryEmbed.class at line 764 (gallerystatus::error)
* in /home/xxxx/public_html/drupal/modules/gallery/gallery.module at line 185 (galleryembed::getimageblock)
* in ??? at line 0
* in /home/xxxx/public_html/drupal/includes/module.inc at line 182
* in /home/xxxx/public_html/drupal/modules/block.module at line 502
* in ??? at line 0
* in /home/xxxx/public_html/drupal/includes/module.inc at line 182
* in /home/xxxx/public_html/drupal/includes/theme.inc at line 864
* in ??? at line 0
* in /home/xxxx/public_html/drupal/includes/theme.inc at line 194
* in /home/xxxx/public_html/drupal/themes/engines/phptemplate/phptemplate.engine at line 204
* in ??? at line 0
* in /home/xxxx/public_html/drupal/includes/theme.inc at line 190
* in /home/xxxx/public_html/drupal/modules/node.module at line 1727
* in ??? at line 0
* in /home/xxxx/public_html/drupal/includes/menu.inc at line 354

Does the captcha module ever display a number?

Does the captcha module ever display a number? Because if not, I want to delete the word "number" from the captcha instructions ("Please type in the letters/numbers that are shown in the image above. ") -- Sometimes a user is confused if he's seeing zero or the letter O or the number one as opposed to the letter I.

Thanks in advance. :)

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions