[SOLVED] Help: News Category Links/Pages

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
sam_butler
Forum Members
Forum Members
Posts: 24
Joined: Sun Jul 20, 2008 3:36 pm

[SOLVED] Help: News Category Links/Pages

Post by sam_butler »

[Taken to the forum after brief message discussion with Mark!]

Okay, orientation: News template. Here's the issue:

I want my summary templates to display the category as usual, but with the category name as a link to a summary page for *that category only*. Dynamically creating such links is proving to be a nightmare. I know I can create a page with a News call using the category parameter but when I turn the site over to my client they would have to create such a page each time they added a news category, unless I made it static (which would be odd). Hope you're tracking with me so far...

When I use the browsecat param the pretty URLs break down as well, so each category link's URL has a huge and very ugly query string appended. I don't want this, also for security purposes. I would much rather this all be dynamic but I don't know how and can't seem to find the answer.

Over to the community...
Last edited by sam_butler on Sun Jul 27, 2008 10:32 am, edited 1 time in total.
sam_butler
Forum Members
Forum Members
Posts: 24
Joined: Sun Jul 20, 2008 3:36 pm

Re: Help: News Category Links/Pages

Post by sam_butler »

Still nothing on this? Help would be appreciated.

Re-posted at http://forum.cmsmadesimple.org/index.php/topic,24047.0.html
Last edited by sam_butler on Wed Jul 23, 2008 6:16 pm, edited 1 time in total.
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: Help: News Category Links/Pages

Post by kermit »

Code: Select all

// retrieve a news category via url and assign to smarty
// append ?newscat=somecategory or &newscat=somecategory (if already at least one param present)
// to a url, call {thisudt} in that page and can then use category="$newscat" in a news module call
// notes:
// no checking is done, make sure what you append is valid
// should work regardless of pretty url scheme used (see note on ? vs &)
$cat = 'general'; // default if newscat param not present in request uri
if(isset($_GET['newscat'])) $cat = $_GET['newscat'];
$smarty->assign('newscat',$cat);
this does use one of those ugly url parameters, but it's only one...

news template would have something like this for category links:

category|escape:'url'}">{$entry->category}

and then on page 'alias-of-category-summary-page':

{thisudt}
{cms_module module='news' category="$newscat"}

note: not fully tested on things like multiple word categories (should work), multiple categories or wildcard to show child categories (probably not as-is), entities in category names (dunno, didn't check)... but this should get you going.
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
sam_butler
Forum Members
Forum Members
Posts: 24
Joined: Sun Jul 20, 2008 3:36 pm

Re: Help: News Category Links/Pages

Post by sam_butler »

Alright, so I have my site stable at the moment and am working to fill it with copy and photos/graphics so I have a presentable 'release candidate' but I plan to try these things out as soon as I'm a little less busy.

Also, this UDT sounds like a good idea because http://cmsmssite/index.php?foo=bar is much better than http://cmsmssite/index.php/?foobar=foo, ... tplace=yes

That's kinda how ugly it was getting  :P

Thanks for your contribs, I'll report back when I've tested.
sam_butler
Forum Members
Forum Members
Posts: 24
Joined: Sun Jul 20, 2008 3:36 pm

Re: [SOLVED] Help: News Category Links/Pages

Post by sam_butler »

Parfait dude. Works a treat.  ;D

Thank you very much!
Post Reply

Return to “CMSMS Core”