Support Forums

Extra field variable

This is a discussion on Extra field variable within the Technical Support forums, part of the Technical Support Forums category; are there variables which carries the values of the extra fields? Currently, the value of extra fields are shown on ...


Go Back   68 Classifieds Forums > Technical Support Forums > Technical Support

This topic is resolved.

If you have a similar issue that this thread does not address, open a new related support topic.

 
Thread Tools Display Modes
Old 04-22-2009, 08:02 AM   #1
Member
 
Join Date: Jun 2008
Location: Maldives
Posts: 66
Rep Power: 7
business is on a distinguished road
Default Extra field variable

are there variables which carries the values of the extra fields? Currently, the value of extra fields are shown on the viewlisting page without us having much control on how it is formated/presented. If we know the variable, say for the value of extrafield1, then we can use this variable to present the value within the viewlisting.... and have more flexiblity in presentation/format and where to show it. thanks.
v4.1.2 - developer.
business is offline  
Old 04-22-2009, 08:45 AM   #2
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,721
Rep Power: 50
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

As you didn't specify what extra fields that you are referring to or where you are trying to display them, makes it harder to give specific advice. There are 3 built in extra fields that can be used for the registration as well as the built in function to create as many extra fields as would like specific to categories.

To use the extra fields built into the registration, that are described in the documentation you use extra, extra2 and extra3.

To use the extra fields that you create for categories, you can use the built in smarty function as explained in the documentation.

You can find out what variables are available for any given template by using the built in smarty debug, by placing {debug} at the top of your layout.tpl file. Make sure that you have any pop up window blockers off. Visit any page and the debug pop up window will show you all variables.
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified)
Sandbox (v3.1.10, v4.0.9, 4.1.5)
Visit My blog for tips, tricks, tutorials, reviews for 68 Classifieds as well as my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline  
Old 04-22-2009, 09:11 AM   #3
Member
 
Join Date: Jun 2008
Location: Maldives
Posts: 66
Rep Power: 7
business is on a distinguished road
Default

thanks for the help... I got it. (i was looking to display category extra fields in viewlisting ... thanks
business is offline  
Old 04-22-2009, 09:30 AM   #4
Member
 
Join Date: Jun 2008
Location: Maldives
Posts: 66
Rep Power: 7
business is on a distinguished road
Default

I tried to display the value if the field value is not blank. I used the statement:
{if {get_extra_field id=$view fid=10}<>""} and gives an error... what am i doing wrong?
business is offline  
Old 04-22-2009, 10:16 AM   #5
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,721
Rep Power: 50
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Aha, this is why you need to give more detail in what you are asking for, especially what the end result that you are looking for.

If I am understanding you correctly, what you want as an end result is that will only display an extra field if it has a value, otherwise do not show it?

I did this exactly for one of my clients along with some extra stuff that would correct an extra field that had multiple values in it, because for some reason the result always returns one more result than there actually is. What I did was make a copy of the extra fields smarty plugin and called it function.get_extra_field2.php

I added some additional logic and sql queries. On return, filtered the results to get rid of the extra blank value and the extra "," that goes along with that. I then changed the final output to go within the existing table with two columns in the viewlisting.tpl file. e.g. <tr><td>title</td><td>value</td></tr>

I have attached the modified smarty plugin to this post. To use it, it works just like the original, however you call it as {get_extra_field2 id=$view fid=X}. You may need to modify the output at the end of the file to suit your implementation in the viewlsitng template file that you are using.
Attached Files
File Type: zip function.get_extra_field2.php.zip (1.4 KB, 22 views)
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified)
Sandbox (v3.1.10, v4.0.9, 4.1.5)
Visit My blog for tips, tricks, tutorials, reviews for 68 Classifieds as well as my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline  
Old 04-23-2009, 02:26 AM   #6
Member
 
Join Date: Jun 2008
Location: Maldives
Posts: 66
Rep Power: 7
business is on a distinguished road
Default

thanks for this great help.
how do i use the if statement with variable in the format {get_extra_field2 id=$view fid=X}..... just to check if the variable contains value. thanks
business is offline  
Old 04-23-2009, 08:18 AM   #7
68 Evangelist & Developer
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,721
Rep Power: 50
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

Quote:
Originally Posted by business
thanks for this great help.
how do i use the if statement with variable in the format {get_extra_field2 id=$view fid=X}..... just to check if the variable contains value. thanks
You don't! That's the reason for this modified version. It does that in the function itself. If the value of the extra field is blank/null, the output is nothing!

Example 1:
If your extra field in a car category was "Color" (extra field id=12) and the ad listing input was "Fire Engine Red"
Then this:
{get_extra_field2 id=$view fid=12}

Would output:
<tr><td>Color</td><td>Fire Engine Red</td></tr>

If there wasn't anything in the color field for that ad then it would output nothing! No logic needed in the template, just the smarty function as above.

Example 2:
You have the same Car category and you set up extra field (fid=14) called "Features" and this was a checkbox field with checkboxes for [] A/C [] power steering [] Automatic [] leather [] AM/FM [] CD and all were checked.

This:
{get_extra_field2 id=$view fid=14}

Would output:
<tr><td> Features </td><td>A/C, power steering, Automatic, leather, AM/FM, CD</td></tr>

If no features were checked in the ad, again the output would be nothing.
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified)
Sandbox (v3.1.10, v4.0.9, 4.1.5)
Visit My blog for tips, tricks, tutorials, reviews for 68 Classifieds as well as my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline  
Old 04-23-2009, 09:50 AM   #8
Member
 
Join Date: Jun 2008
Location: Maldives
Posts: 66
Rep Power: 7
business is on a distinguished road
Default

thanks.... i could use this very much.
in addition, sometimes, depending on the content of the extra field, i might want to display an image or special text. eg. say I am using extra field 6 to enter the condition of item. Possible values are Brand New & Used. In viewlisting, if the value of extra field is "Brand New" i could include an image to show it's Brand New ... (the image could be more colorful and interesting than plain text saying "Brand New"....
business is offline  
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Get Extra Field Eric Barnes Modification Release 4 11-28-2008 05:39 PM
Change format in "date field" extra field topbidz Technical Support 2 05-01-2008 08:38 PM
Extra field louad v3.1 Questions & Support 3 02-06-2007 03:58 PM
Extra Field Misiu02 v3.1 Modules & Modifications 2 10-24-2006 01:33 PM
Select field problem (extra field --> drop down list) pat01 v3.1 Questions & Support 1 08-10-2006 03:05 AM


All times are GMT -4. The time now is 01:08 AM.


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