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:
- 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.
- campusnews.tpl.php has a script that grabs node items that match certain taxonomy requirements (see campusnews code below).
- 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.
- Using flexinode I've created a custom content type called "campus news", and another called "campus news page".
- Within the taxonomy module I've created vocabulary and terms for categorizing campus news items by issue, and placement (see example below)
- Every campus news item is given taxonomy for assigning an issue date, and a placement (where it appears on the campus news page).
- 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 "
";
}
echo "
" . $value['title'] . "
";
echo "
". $value['description'] ."