Skip to content

Instantly share code, notes, and snippets.

@aaronmcadam
Created May 13, 2010 00:23
Show Gist options
  • Save aaronmcadam/399320 to your computer and use it in GitHub Desktop.
Save aaronmcadam/399320 to your computer and use it in GitHub Desktop.
LG Better Meta Sitemap implementation
<?php
global $IN;
// Getting the last segment of the URL
if (sizeof($IN->SEGS) > 1) {
$last_seg = ($IN->QSTR == 'index') ? $IN->SEGS[sizeof($IN->SEGS)-1] : $IN->QSTR;
} else if (sizeof($IN->SEGS) == 0) {
$last_seg = "home";
}
else {
$last_seg = ($IN->QSTR == 'index') ? $IN->SEGS[sizeof($IN->SEGS)] : $IN->QSTR;
}
// Setting weblog_id by Segment
switch( $IN->SEGS[1] ) {
case 'about' :
switch( $IN->SEGS[2] ) {
case 'news' :
$weblog_id = 16;
break;
case 'events' :
$weblog_id = 31;
break;
case 'people' :
$weblog_id = 23;
break;
case 'careers' :
$weblog_id = 24;
break;
case 'contact' :
$weblog_id = 25;
break;
case 'referrals' :
$weblog_id = 30;
break;
default :
$weblog_id = 6;
}
break;
case 'news' :
$weblog_id = 16;
if ( $IN->SEGS[2] == "story" ) {
$weblog_id = 4;
$last_seg = $IN->SEGS[3];
}
break;
case 'products' :
$weblog_id = 8;
if ( $IN->SEGS[2] == "product" ){
$weblog_id = 3;
}
break;
case 'solutions' :
$weblog_id = 14;
if ( $IN->SEGS[2] == "solution" ){
$weblog_id = 15;
}
break;
case 'industries' :
$weblog_id = 12;
if ( sizeof($IN->SEGS) == 2 ) {
$weblog_id = 13;
}
break;
case 'blog' :
$weblog_id = 19;
if ( sizeof($IN->SEGS) == 3 ) {
$weblog_id = 20;
}
break;
default :
$weblog_id = 2;
}
?>
{exp:lg_better_meta_pl:template url_title="<?php echo $last_seg; ?>" weblog_id="<?php echo $weblog_id; ?>"}
@aaronmcadam
Copy link
Author

For creating a sitemap with LG Better Meta plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment