Summary and content
2 posts by 2 authors in: Forums > CMS Builder
Last Post: March 11, 2009 (RSS)
By Ginslinger - March 10, 2009
OK, my brain is set to stupid tonight. Been working on Article manager for one client and now on CMSB for our church.
Created a mult-record editor that I need to have show 1 record on the front page with a read more link to that article. I also need to be able to display on the same detail page a list of past articles from this same editor. I had it working before in a template but my computer crashed and I lost a bunch of files. How do I accomplish this?
Created a mult-record editor that I need to have show 1 record on the front page with a read more link to that article. I also need to be able to display on the same detail page a list of past articles from this same editor. I had it working before in a template but my computer crashed and I lost a bunch of files. How do I accomplish this?
Re: [Ginslinger] Summary and content
By Dave - March 11, 2009
Hi Ginslinger,
You can add some options to the viewer code.
To load just one result, try this:
'limit' => 1,
To load some results from the same author, first figure out how to print out their name. It will be something like this (but the variable name will be different):
<?php echo $articleRecord['author'] ?>
Once you get that working, add another viewer code block _below_ the first one at the top of the page that loads all articles and has a where option like this:
'where' => " author = '" .mysql_real_escape_string(@$articleRecord['author']). "' ",
It's a little complex. I can break it down into multiple lines but one line is easiest for cut and paste. Basically we get the author name, then we do another query for all articles from that author. And the escape string bit is just for security.
Hope that helps, let me know how far you get or if you need more help!
You can add some options to the viewer code.
To load just one result, try this:
'limit' => 1,
To load some results from the same author, first figure out how to print out their name. It will be something like this (but the variable name will be different):
<?php echo $articleRecord['author'] ?>
Once you get that working, add another viewer code block _below_ the first one at the top of the page that loads all articles and has a where option like this:
'where' => " author = '" .mysql_real_escape_string(@$articleRecord['author']). "' ",
It's a little complex. I can break it down into multiple lines but one line is easiest for cut and paste. Basically we get the author name, then we do another query for all articles from that author. And the escape string bit is just for security.
Hope that helps, let me know how far you get or if you need more help!
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com