Support Forums


Go Back   68 Classifieds Forums > Help & Support > v4.1 Questions & Support

Notices

 
LinkBack Thread Tools Display Modes
Old 04-22-2009, 07:02 AM   #1
Junior Member
 
Join Date: Jun 2008
Posts: 19
Rep Power: 4
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   Reply With Quote
Old 04-22-2009, 07:45 AM   #2
Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,397
Rep Power: 41
Mike-N-Tosh is just really niceMike-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
v3.1.10 Developer IndianaPC.org - A community website
Sandbox v4.0.9, 4.1
Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds.
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   Reply With Quote
Old 04-22-2009, 08:11 AM   #3
Junior Member
 
Join Date: Jun 2008
Posts: 19
Rep Power: 4
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   Reply With Quote
Old 04-22-2009, 08:30 AM   #4
Junior Member
 
Join Date: Jun 2008
Posts: 19
Rep Power: 4
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   Reply With Quote
Old 04-22-2009, 09:16 AM   #5
Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,397
Rep Power: 41
Mike-N-Tosh is just really niceMike-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, 11 views)
__________________
Mike-N-Tosh
v3.1.10 Developer IndianaPC.org - A community website
Sandbox v4.0.9, 4.1
Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds.
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   Reply With Quote
Old 04-23-2009, 01:26 AM   #6
Junior Member
 
Join Date: Jun 2008
Posts: 19
Rep Power: 4
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   Reply With Quote
Old 04-23-2009, 07:18 AM   #7
Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,397
Rep Power: 41
Mike-N-Tosh is just really niceMike-N-Tosh is just really nice
Default

Quote:
Originally Posted by business View Post
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
v3.1.10 Developer IndianaPC.org - A community website
Sandbox v4.0.9, 4.1
Templates, Mods & Docs for sale | My blog with much content for 68 Classifieds.
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   Reply With Quote
Old 04-23-2009, 08:50 AM   #8
Junior Member
 
Join Date: Jun 2008
Posts: 19
Rep Power: 4
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   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 08:49 PM.


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