I have the questions module running on my site and I would like to have two slightly different summary templates depending whether or not the question has been answered - basically, I want the "read the answer" link to be displayed only when the question has actually been answered.
To see it please visit my site:
http://www.shareworld.co.uk it is on the home page.
Different summary template for questions module when answer supplied [solved]
Different summary template for questions module when answer supplied [solved]
Last edited by davids355 on Mon Oct 27, 2008 8:47 pm, edited 1 time in total.
Re: Different summary template for questions module when answer supplied
Hi!
I've never tried Question module but maybe it would work with this
{if isset(variable_for_answer)}answer link {else} blah blah {/if}
can you post your template here?
/Coldman
I've never tried Question module but maybe it would work with this
{if isset(variable_for_answer)}answer link {else} blah blah {/if}
can you post your template here?
/Coldman
Important Code of Conduct
Why don't use CMSMS Docs or search?
Do you read Help?
Admin for Swedish Translations Team
Moderator Swedish Forum
After your problem is solved, push the green button
Why don't use CMSMS Docs or search?
Do you read Help?
Admin for Swedish Translations Team
Moderator Swedish Forum
After your problem is solved, push the green button
Re: Different summary template for questions module when answer supplied
Heres my template:
How would I find out what the variable for answer is?
How would I find out what the variable for answer is?
Code: Select all
<!-- Start Questions Summary Template -->
{* the get_template_vars smarty plugin, and print_r can be very useful here
i.e: to see the fields that can be displayed, try {$itmes|print_r} *}
{if isset($formstart)}
{/if}
{foreach from=$items item=entry}
<div style="border-bottom: 0px solid; margin-bottom: 5px;">
<p>{$entry->question}<br /><span style="font-weight: normal; color: grey;">Posted on {$entry->created|date_format} by {$entry->author}</span><br />{$entry->morelink}</p>
</div>
{/foreach}
<!--{if $pagecount > 1}
<p>
{if $pagenumber > 1}
{$firstpage} {$prevpage}
{/if}
{$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
{$nextpage} {$lastpage}
{/if}
</p>
{/if}
-->
<!-- End Questions Summary Template -->
Re: Different summary template for questions module when answer supplied
you can put {$entry|print_r} below {foreach from=$items item=entry} in your template and refresh that page were you have the question module.
My guess it should be something like this {$entry->answer}
If that's correct then try this:
My guess it should be something like this {$entry->answer}
If that's correct then try this:
Code: Select all
{* the get_template_vars smarty plugin, and print_r can be very useful here
i.e: to see the fields that can be displayed, try {$itmes|print_r} *}
{if isset($formstart)}
{/if}
{foreach from=$items item=entry}
<div style="border-bottom: 0px solid; margin-bottom: 5px;">
<p>{$entry->question}<br /><span style="font-weight: normal; color: grey;">Posted on {$entry->created|date_format} by {$entry->author}</span><br /> {if isset($entry->answer)} {$entry->morelink} {else} No answer yet {/if}</p>
</div>
{/foreach}
<!--{if $pagecount > 1}
<p>
{if $pagenumber > 1}
{$firstpage} {$prevpage}
{/if}
{$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
{$nextpage} {$lastpage}
{/if}
</p>
{/if}
-->
<!-- End Questions Summary Template -->
Important Code of Conduct
Why don't use CMSMS Docs or search?
Do you read Help?
Admin for Swedish Translations Team
Moderator Swedish Forum
After your problem is solved, push the green button
Why don't use CMSMS Docs or search?
Do you read Help?
Admin for Swedish Translations Team
Moderator Swedish Forum
After your problem is solved, push the green button
Re: Different summary template for questions module when answer supplied
Thanks alot Coldman. That worked a treat! Much appreciated.