So my problem is the detail template isn't being applied when pretty urls are being used. I've tried hardcoding it into .htaccess like so:
RewriteRule ^([0-9]*)/([0-9]*)/([0-9a-zA-Z\-]*).html$ index.php?mact=CGBlog,cntnt01,detail,0&cntnt01articleid=$1&cntnt01detailtemplate=blog_detail&cntnt01returnid=$2 [NC,L]
with no joy(with or without that line). I know with the News module the the url would've been something like:
"http://www.mysite.com/news/1/34/news-it ... te-id.html
but I don't see that behavior with the CGBlog module. Am I doing something wrong or is that just not a feature of the current release?
[SOLVED] CGBlog -> Detail Template + Pretty Urls
- kidcardboard
- Forum Members
- Posts: 54
- Joined: Mon Sep 28, 2009 5:25 pm
[SOLVED] CGBlog -> Detail Template + Pretty Urls
Last edited by Dr.CSS on Fri Feb 17, 2012 4:51 pm, edited 2 times in total.
Reason: Please use double quotes on fake links so they aren't clickable...
Reason: Please use double quotes on fake links so they aren't clickable...
Re: [SOLVED] CGBlog -> Detail Template + Pretty Urls
How did you eventually solve this?
Re: [SOLVED] CGBlog -> Detail Template + Pretty Urls
I also have a problem applying a detail template
Did anyone resolve this?
Did anyone resolve this?
Re: [SOLVED] CGBlog -> Detail Template + Pretty Urls
The only way I managed to solve it, was to make a few if statements in the default template, and then just paste template layout inside the if block, thus creating monstrously huge and messy template file. Yet, it works.
Would be great to finally have it fixed in the module itself.
Would be great to finally have it fixed in the module itself.
Re: [SOLVED] CGBlog -> Detail Template + Pretty Urls
Had the same issue and my solution was similar but needs less coding in the summary template.
It checks the URL to see if the blog prefix that I entered in the Options tab exists. If so, it means that I need a detail template.
The following code then explodes the {$cgsimple->self_url()} string into an array based on the '/' character. I then count the number of array items to find the article id and finally call the detail template with this id.
NB: You need to put the ending {/if} just before the last {/if} in the summary template to close the statement and have CGSimpleSmarty installed.
At the top of the Summary template:
hth
psy
It checks the URL to see if the blog prefix that I entered in the Options tab exists. If so, it means that I need a detail template.
The following code then explodes the {$cgsimple->self_url()} string into an array based on the '/' character. I then count the number of array items to find the article id and finally call the detail template with this id.
NB: You need to put the ending {/if} just before the last {/if} in the summary template to close the statement and have CGSimpleSmarty installed.
At the top of the Summary template:
Code: Select all
{if count($items) ne 0}
{if $cgsimple->self_url()|strpos:'blog' !== false}
{assign var=x value="/"|explode:$cgsimple->self_url()}
{CGBlog action=detail articleid=$x.4}
{else}
{* rest of normal summary template *}
{/if}
psy
Re: [SOLVED] CGBlog -> Detail Template + Pretty Urls
Im not sure that i understood you coretctly,
my summary page looks like this;
But detailtemplate is not apllied..
my summary page looks like this;
Code: Select all
{if count($items) ne 0}
{if $cgsimple->self_url()|strpos:'blog' !== false}
{assign var=x value="/"|explode:$cgsimple->self_url()}
{CGBlog action=detail articleid=$x.4}
{else}
{* rest of normal summary template *}
<div class="pero">
{foreach from=$items item=entry name="newsentry"}
<a href="{$entry->detail_url}" title="{$entry->title|cms_escape:htmlall}">
<h2>{$entry->title|cms_escape}</h2>
{assign var=post value=$entry->id}
{assign var=img value=$entry->sliderbig}
<div class="summaryimage">{if isset($entry->fieldsbyname.sliderbig)}
{supersizer path="uploads/news/id$post/$img" height=250 alt=$entry->title|cms_escape:htmlall}{/if}
</div>
</a>
{/foreach}
</div>
{/if}{/if}
Re: [SOLVED] CGBlog -> Detail Template + Pretty Urls
In short, the code takes the pretty URL, splits it into an array based on the '/' character and assigns it to $x.
Sample URL: "http://mysite.com/blog/39/My-Article-Name.html
Things to check:
1. The text to search is called '/blog/'. Change the string to whatever you've called it in the options
2. The index number in the $x array of the article id is 4. Print out the $x array to confirm you are getting the correct item. Using the above URL, the array would look like:
So we call $x.4 when we need the article id.
The same thing works when you need to list a particular category, eg:
Sample URL: "http://mysite.com/blog/category/19/General.html
In this case the search string is '/category/' and the category id number, 19, is stored in $x.5
Also, in the past I've found sometimes calling a module within another module template does not work when you use the shorter plugin version, eg {CGBlog}. Use the full {cms_module module=CGBlog ...} tag instead. Not sure this is still relevant with 1.10+ but worth a try.
Hope this helps
psy
Sample URL: "http://mysite.com/blog/39/My-Article-Name.html
Things to check:
1. The text to search is called '/blog/'. Change the string to whatever you've called it in the options
2. The index number in the $x array of the article id is 4. Print out the $x array to confirm you are getting the correct item. Using the above URL, the array would look like:
Code: Select all
x = Array
[0] = 'http'
[1] = ''
[2] = 'mysite.com'
[3] = 'blog'
[4] = 39
[5] = 'My-Article-Name.html'
The same thing works when you need to list a particular category, eg:
Sample URL: "http://mysite.com/blog/category/19/General.html
Code: Select all
{assign var=x value="/"|explode:$cgsimple->self_url()}
{if $cgsimple->self_url()|strpos:'/category/' !== false}
{cms_module module=CGBlog action=default category_id=$x.5 showall=1 summarytemplate=summary-by-category}
In this case the search string is '/category/' and the category id number, 19, is stored in $x.5
Also, in the past I've found sometimes calling a module within another module template does not work when you use the shorter plugin version, eg {CGBlog}. Use the full {cms_module module=CGBlog ...} tag instead. Not sure this is still relevant with 1.10+ but worth a try.
Hope this helps
psy