Wahrscheinlich ist es schon einigen aufgefallen, dass ich mich eifrig mit Joomla und php beschäftige. Da Joomla zwar sehr geil ist, die Seite die dynamische Website aber genauso aussehen soll, wie ihr statischer Vorgänger, muss ich im templateordner in der index.php Datei etwas am Code hand anlegen. Nun dachte ich wäre alles geschafft, und ich habe die härtesten Sachen hinter mir, da kommt dann der heftigste Brocken.
Das ganze nennt sich Seitenweise umblättern.
Ich versuche gerade ein Mambot umzubauen, so dass es als php.script funktioniert, das Problem sitzt am Anfang, den ich bekomme einen Fatal Error. Als Mambot funktioniert es in Joomla, nur möchte ich das Script an einer anderen Stelle haben.
Fast am Schluss des Code kommt hier auch noch mal ein "Blankchecker for SEF" welches ich für den URL Design einsetze. Je weiter es zum Schluss hingeht, um so verständlicher und klarer finde ich den Code, das einzige Problem ist wohl der Einstieg.
Das ganze nennt sich Seitenweise umblättern.
Ich versuche gerade ein Mambot umzubauen, so dass es als php.script funktioniert, das Problem sitzt am Anfang, den ich bekomme einen Fatal Error. Als Mambot funktioniert es in Joomla, nur möchte ich das Script an einer anderen Stelle haben.
Code:
registerFunction( 'onPrepareContent', 'botPrevNext' );
function botPrevNext( $published, &$row, $params, $page=0 ) {
global $mainframe, $database, $mosConfig_absolute_path,$mosConfig_lang;
if (!$published ) {
return true;
}
// Get the right language if it exists
if (file_exists($mosConfig_absolute_path.'/mambots/content/rd_prevnext.'.
$mosConfig_lang.'.php')) {
include_once($mosConfig_absolute_path.'/mambots/content/rd_prevnext.'.
$mosConfig_lang.'.php');
} else {
include_once($mosConfig_absolute_path.'/mambots/content/rd_prevnext.
english.php');
}
$task = mosGetParam( $_REQUEST, 'task', '' );
if ( ( $task == "view" ) && !$params->get( 'popup' ) ) {
// loads the links for Next & Previous Button
$query = "SELECT a.id"
. "n FROM jos_content AS a"
. "n WHERE a.catid = ". $row->catid.""
. "n AND a.catid != 0 AND a.state = '1' AND ordering ordering"
. "n ORDER BY a.ordering DESC"
. "n LIMIT 1"
;
$database->setQuery( $query );
$row->prev = $database->loadResult();
$query = "SELECT a.id"
. "n FROM jos_content AS a"
. "n WHERE a.catid = ". $row->catid.""
. "n AND a.catid != 0 AND a.state = '1' AND ordering > $row->ordering"
. "n ORDER BY a.ordering"
. "n LIMIT 1"
;
$database->setQuery( $query );
$row->next = $database->loadResult();
$nav = $row->prev + $row->next;
if ( $row->prev || $row->next ) {
$row->text = $row->text . '' . _RD_PREVNEXT_HEAD;
}
if ( $row->prev ) {
$prev=$row->prev;
$query = "Select title,title_alias from jos_content where id = '$prev'";
$database->setQuery($query);
$database->loadObject($result);
$title= $result->title;
$alias = $result->title_alias;
$query = "select id from jos_menu where published = '1'
and type = 'content_item_link' and componentid= '$prev'";
$database->setQuery( $query );
$Itemid = $database->loadresult();
if (!$Itemid) {
// needed to reduce queries used by getItemid
$bs = $mainframe->getBlogSectionCount();
$bc = $mainframe->getBlogCategoryCount();
$gbs = $mainframe->getGlobalBlogSectionCount();
// get Itemid
$Itemid = $mainframe->getItemid( $prev, 0, 0, $bs, $bc, $gbs );
}
// Blank itemid checker for SEF
if ($Itemid == NULL) {
$Itemid = '';
} else {
$Itemid = '&Itemid='. $Itemid;
}
if ($alias) {
$linktext = $alias;
} else {
$linktext = $title;
}
$link = ''._RD_PREVNEXT_PC.''
. $linktext . '. ';
if (!$row->next) $link . $enddiv;
$row->text = $row->text . $link;
}
if ( $row->prev && $row->next ) {
$row->text = $row->text . '
';
}
if ( $row->next ) {
$next=$row->next;
$query = "Select title,title_alias from jos_content where id = '$next'";
$database->setQuery($query);
$database->loadObject($result);
$title= $result->title;
$alias = $result->title_alias;
$query = "select id from jos_menu where published = '1'
and type = 'content_item_link' and componentid='$next';";
$database->setQuery( $query );
$Itemid = $database->loadResult();
if (!$Itemid) {
// needed to reduce queries used by getItemid
$bs = $mainframe->getBlogSectionCount();
$bc = $mainframe->getBlogCategoryCount();
$gbs = $mainframe->getGlobalBlogSectionCount();
// get Itemid
$Itemid = $mainframe->getItemid( $next, 0, 0, $bs, $bc, $gbs );
}
// Blank itemid checker for SEF
if ($Itemid == NULL) {
$Itemid = '';
} else {
$Itemid = '&Itemid='. $Itemid;
}
if ($alias) {
$linktext = $alias;
} else {
$linktext = $title;
}
$link = ''._RD_PREVNEXT_NC.''
. $linktext . '. ';
$row->text = $row->text . $link;
}
if ( $row->prev || $row->next ) {
$row->text = $row->text . '';
}
}
return true;
}
?>
Fast am Schluss des Code kommt hier auch noch mal ein "Blankchecker for SEF" welches ich für den URL Design einsetze. Je weiter es zum Schluss hingeht, um so verständlicher und klarer finde ich den Code, das einzige Problem ist wohl der Einstieg.