Im trying to make a module that will generate a xml file of all the links in the site,
much like a RSS feed but with just the permalinks for all the pages in the site.
My problem is i can’t find a method that will generate the Advertised Permalink that when templates are involved
For example
http://www.domain.com/site/my_page is what im creating using
$FNS->create_url('site/'.$post['url_title']);
This works but not when im working with templates
http://www.domain.com/template/page/my_page is the permalink that im looking for, but how can I create this. below is a short example of my select and url creation. I have spent a great deal of time looking into this without resolution.
$results = $DB->query("SELECT DISTINCT(wt.entry_id) AS id, wt.title AS title, wt.url_title AS url_title, wt.weblog_id, wt.entry_date AS entry_date, exp_weblog_data.field_id_2 AS body
FROM exp_weblog_titles wt, exp_weblog_data,exp_weblogs
WHERE wt.entry_id = exp_weblog_data.entry_id AND wt.status != 'closed'");
echo "<link>" . $FNS->create_url('site/'.$post['url_title'], 0) . "</link>\n";
It seems like there should be some sort of permalink function, most other engines have something similar
I was looking at the LG site map plugin demo and it looks like they require you to create permalink that will be used in the sitemap via a custom feild, which seems silly.
what do you mean in conjunction? if comment_url exists use it ? otherwise use blog_url?
something like this ?
$results = $DB->query("SELECT DISTINCT(wt.entry_id) AS id, exp_weblogs.comment_url, wt.title AS title, wt.url_title AS url_title, wt.weblog_id, wt.entry_date AS entry_date, exp_weblog_data.field_id_2 AS body
FROM exp_weblog_titles wt, exp_weblogs.blog_url, exp_weblog_data,exp_weblogs
WHERE wt.entry_id = exp_weblog_data.entry_id AND wt.status != 'closed'");
foreach($results->result as $post){
//remove comments info if it exists
$perm_url=str_replace('/comments/','',$post['comment_url']);
//if empty comment url add blogurl instead
if (empty($perm_url)) $perm_url=$post['blog_url'];
//add the title to the base url to get permalink
$url=$FNS->remove_double_slashes($perm_url.'/'.$post['url_title']);
echo $url.",";
}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.