Support Forums

extra field variable not evaluated

This is a discussion on extra field variable not evaluated within the Templates, HTML, CSS, and Design Help forums, part of the General category; I have an extra field (drop-down list) with a value "Yes". In the templates, I am assigning it to a ...


Go Back   68 Classifieds Forums > General > Templates, HTML, CSS, and Design Help

Reply
 
Thread Tools Display Modes
Old 01-08-2010, 02:13 AM   #1
Customer
 
Join Date: Jun 2008
Location: Maldives
Posts: 134
Rep Power: 16
business is on a distinguished road
Default extra field variable not evaluated

I have an extra field (drop-down list) with a value "Yes".
In the templates, I am assigning it to a variable using the following:

Code:
{capture name='whatisyourprice'}
{get_extra_field id=$view fid=82}
{/capture}
then I am using it to display some other text depending on the value... so I am using the following if statement:

Code:
        {if $smarty.capture.whatisyourprice=="Yes"}
        ...... additional text and forms....
        {/if}
But it seems the condition does not get executed even if the value is "Yes".... but when I display the variable {$smarty.capture.whatisyourprice} it outputs "Yes"... There are no trailing spaces. why isn't the condition getting evaluated.
I have faced similar issue previously as well.
thanks for any help.
__________________
v 4.2.0 Developer - Default Template
business is offline   Reply With Quote
Old 01-08-2010, 03:01 AM   #2
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,342
Rep Power: 84
seymourjames is a jewel in the rough
Default

I had this issue and never quite resolved it in the way you are trying to do it. I can't quite remember the issue. What I did which finally worked was made a copy of the plugin and put the test within it. I may be completely of base here but try putting the test within it.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates & Modules
Get the Best U.S Hosting, Best U.K Hosting
seymourjames is offline   Reply With Quote
Old 01-08-2010, 08:55 AM   #3
curmudgeon
 
Join Date: Mar 2006
Posts: 5,413
Rep Power: 138
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

I think the problem may be that {capture} is designed to capture template output but what you have between the capture tags is really a plugin and while it does return output to the template there may be some issues with when/where/how the plugin actually runs.

A twist on Davids idea would be to just alter the last line of the plugin where it returns the value and echo a template assign of the value the plugin collected to a template var.
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 01-08-2010, 10:05 AM   #4
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,342
Rep Power: 84
seymourjames is a jewel in the rough
Default

That was it Larry. I remember doing that now from your prompt. I tested and changed the output.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates & Modules
Get the Best U.S Hosting, Best U.K Hosting
seymourjames is offline   Reply With Quote
Old 01-08-2010, 10:12 AM   #5
Customer
 
Join Date: Jun 2008
Location: Maldives
Posts: 134
Rep Power: 16
business is on a distinguished road
Default

i think getting the output as a template variable is a good idea.
I tried to add the following at the end of the plugin file:

Code:
		$class_tpl->assign('value',$value);
		$class_tpl->assign('body','viewlistings2.tpl');
now in viewlistings2.tpl I tried to display the value by putting {$value} but doesn't show any output. (When I use the get_extra_field the value is shown)

Am I using the the correct codes for passing the variable to the template? thanks for the help.
__________________
v 4.2.0 Developer - Default Template
business is offline   Reply With Quote
Old 01-08-2010, 10:22 AM   #6
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,342
Rep Power: 84
seymourjames is a jewel in the rough
Default

Try to make the test within the plugin and echo the variable from within the plugin.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates & Modules
Get the Best U.S Hosting, Best U.K Hosting
seymourjames is offline   Reply With Quote
Old 01-08-2010, 12:37 PM   #7
curmudgeon
 
Join Date: Mar 2006
Posts: 5,413
Rep Power: 138
Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light Lhotch is a glorious beacon of light
Default

You making it tougher than it has to be....

change...

return $value


to


echo '{assign var=foo value='baa'}';

then in the template you chould be able to test the value of the temp var {$foo} and it should be "baa"
__________________
Larry

Knowledge learned is more valuable than knowledge given.
Lhotch is offline   Reply With Quote
Old 01-08-2010, 02:32 PM   #8
Customer
 
Join Date: Jun 2008
Location: Maldives
Posts: 134
Rep Power: 16
business is on a distinguished road
Default

i replaced return $value with

echo '{assign var=whatisyourprice value=$value}';

and used {$whatisyourprice} in the template... but nothing is returned.
__________________
v 4.2.0 Developer - Default Template
business is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assign Extra fields to Variable pipelin Customizations 10 11-08-2009 06:06 PM
Create a extra field just like the price field ? mirway7 Technical Support 3 10-12-2009 11:27 PM
Extra field variable business Technical Support 7 04-23-2009 08:50 AM
Change format in "date field" extra field topbidz Technical Support 2 05-01-2008 07:38 PM


All times are GMT -4. The time now is 09:27 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2011, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0