Jamroom Logo Jamroom 5 Core
is now Open Source!
User Support Forum Archive (Read Only)
Jamroom Developers:
Info not available in header_template.
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 10/04/09 23:40 
I am working on a classified Ads module. I am having issues making some data available to the header_template and footer template. When I place a {debug output="html"} in the header_template I don't see any of the information I have available in the row_template. I assume that this has to do with the custom ranking script. How can I make the information available to the row_template as well as the header template? Any advice would be greatly appreciated.

Back to top
SteveX
Ultrabubble


Joined: 30 Aug 2005
Posts: 8792
Location: Ultrabubble

Posted: 10/05/09 14:31 
What info do you need to make available in the header? Info from the rows cannot be available in the ranking header and footer, but you can pass in additional info using the replace parameter.

from here: http://www.jamroom.net/Jamroom4_Ranking_System

Quote:
If the "replace" parameter is given as an array (this must be prepared beforehand with the {jr_array} template function), then Jamroom will make the replace values available as template variables - i.e. {$REPLACE_0}, {$REPLACE_1}, etc.



_________________
Kulshi Mezian!

"Stranger from another planet, welcome to our hole. Just strap on your guitar and we'll play some rock and roll"

Ultrabubble create things.
Back to top
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 10/05/09 19:37 
Thanks for the reply SteveX. Im not sure the documentation is specific enough for me to understand its usage. Would you be able to give me an example of its usage? How would I determine which value would be assigned to $REPLACE_1, $REPLACE_2, etc?

Back to top
SteveX
Ultrabubble


Joined: 30 Aug 2005
Posts: 8792
Location: Ultrabubble

Posted: 10/06/09 00:25 
{jr_array name="myarray" key="0" value="London"}
{jr_array name="myarray" key="1" value="Paris"}
{jr_array name="myarray" key="2" value="Athens"}
{jr_ranking mode="song" replace=$myarray}

Then in the templates {$REPLACE_0} = London, {$REPLACE_1} = Paris, {$REPLACE_2} = Athens


_________________
Kulshi Mezian!

"Stranger from another planet, welcome to our hole. Just strap on your guitar and we'll play some rock and roll"

Ultrabubble create things.
Back to top
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 10/06/09 00:49 
Thanks again for the reply steveX. How would I apply your example to the retrieval of data from the database from a custom ranking script or from the querystring? IE: ad_title from the DB or order from the querystring?

Back to top
SteveX
Ultrabubble


Joined: 30 Aug 2005
Posts: 8792
Location: Ultrabubble

Posted: 10/06/09 10:32 
Ah, I don't think you would use that for that, I'm not too clear on what you are wanting to do.

Could you use a jr_unique_block within the ranking row?


_________________
Kulshi Mezian!

"Stranger from another planet, welcome to our hole. Just strap on your guitar and we'll play some rock and roll"

Ultrabubble create things.
Back to top
Brian
Jamroom Team


Joined: 09 Jul 2003
Posts: 37583
Location: Seattle, WA

Posted: 10/06/09 11:08 

musiccreatures:
Thanks again for the reply steveX. How would I apply your example to the retrieval of data from the database from a custom ranking script or from the querystring? IE: ad_title from the DB or order from the querystring?


Whenver you are using the ranking system, the "common" variables will be available in all templates - i.e. $RANK_ORDER will contain the order as passed in. If "ad_title" is a column in the database, and you select it in your ranking plugin, then it will become $AD_TITLE in your row_template as well.

Hope this helps!

- Brian


_________________
Make sure and check out:
* The Jamroom FAQ
* The Jamroom Documentation
Back to top
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 10/06/09 13:39 
Thanks for the reply, guys. Heres what Im trying to accomplish. When the ranking script is called, it gathers information from the database, depending on what it is given(pretty typical of a ranking script) If the ranking script isn't given a category_id or an ad_id, It will retrieve a list of Ad categories for display. When the user clicks on one of the categories, it calls the ranking script again, but this time with a category_ID. Since the ranking script received a category_ID but not an ad_id, It retrieves a list of ads, within the category_id it was given.

During this process, I want to have the category Title and description, displayed via the template_header. Then let the row_template, output the list of ad titles(as links that give the ranking script the category_id and its ad_id)

If I try to display the category name and description within the row_template, I imagine it would be outputted as many times as the row_template is "looped" through. So I need to be able to give the header_template the category_name and category_description, if it is needs to be displayed.

Any Ideas? Thanks again for all your help guys. The Jamroom staff and members rock!!! A+

Back to top
SteveX
Ultrabubble


Joined: 30 Aug 2005
Posts: 8792
Location: Ultrabubble

Posted: 10/06/09 15:20 
If you make the category title and description available in every ranking row, you can use a jr_unique_block at the top of the template to only output it once on the first loop:
http://www.jamroom.net/Jamroom4_jr_unique_block

So your row template would be something like:

Code
{jr_unique_block name="category_and_description"}
<h2>{$AD_CATEGORY_TITLE}</h2>
<p>{$AD_CATEGORY_DESCRIPTION}</p>
{/jr_unique_block}

<div class="classified_ad">
<h3>{$AD_TITLE}</h3>
<p>{$AD_DESCRIPTION}</p>
<p>{$AD_CONTACT_DETAILS}</p>
<p>{$AD_PAYPAL_LINK}</p>
</div>



_________________
Kulshi Mezian!

"Stranger from another planet, welcome to our hole. Just strap on your guitar and we'll play some rock and roll"

Ultrabubble create things.
Back to top
SteveX
Ultrabubble


Joined: 30 Aug 2005
Posts: 8792
Location: Ultrabubble

Posted: 10/06/09 15:25 
You could also use the rank number to output in the first row, or the last row.


Code
{if $AD_RANK === 1}
<h2>{$AD_CATEGORY_TITLE}</h2>
<p>{$AD_CATEGORY_DESCRIPTION}</p>
{/if}

<div class="classified_ad">
<h3>{$AD_TITLE}</h3>
<p>{$AD_DESCRIPTION}</p>
<p>{$AD_CONTACT_DETAILS}</p>
<p>{$AD_PAYPAL_LINK}</p>
</div>



_________________
Kulshi Mezian!

"Stranger from another planet, welcome to our hole. Just strap on your guitar and we'll play some rock and roll"

Ultrabubble create things.
Back to top
musiccreatures



Joined: 20 Jun 2009
Posts: 344
Location: Portland Oregon

Posted: 10/06/09 20:34 
Perfect steveX. Thanks for all the assistance.

Back to top
Display posts from previous:   
User Support Forum Archive (Read Only)
Jamroom Developers

 
Solutions
• Social Media Platform
• Social Networking Software
• Musician Website Manager
• Community Builder
Products
• Jamroom Core
• Jamroom Addons
• Jamroom Modules
• Jamroom Marketplace
Support
• Support Forum
• Documentation
• Support Center
• Contact Support
Community
• Community Forum
• Member Sites
• Developers
Company
• About Us
• Contact Us
• Privacy Policy
©2003 - 2010 Talldude Networks, LLC.