|
|
#1 |
|
Junior Member
Join Date: Jun 2008
Posts: 19
Rep Power: 4 ![]() |
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. |
|
|
|
|
|
#2 |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,397
Rep Power: 41 ![]() ![]() |
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 |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Jun 2008
Posts: 19
Rep Power: 4 ![]() |
thanks for the help... I got it. (i was looking to display category extra fields in viewlisting ... thanks
|
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jun 2008
Posts: 19
Rep Power: 4 ![]() |
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? |
|
|
|
|
|
#5 |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,397
Rep Power: 41 ![]() ![]() |
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.
__________________
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 |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Jun 2008
Posts: 19
Rep Power: 4 ![]() |
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 |
|
|
|
|
|
#7 | |
|
Moderator
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 1,397
Rep Power: 41 ![]() ![]() |
Quote:
![]() 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 |
|
|
|
|
|
|
#8 |
|
Junior Member
Join Date: Jun 2008
Posts: 19
Rep Power: 4 ![]() |
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".... |
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
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 |