Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

combined fields database value

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
aidendoyle1981
Smarty Rookie


Joined: 11 Jan 2016
Posts: 9

PostPosted: Wed Jan 13, 2016 7:37 am    Post subject: combined fields database value Reply with quote

Hi all I am a newbie when it comes to smarty. So I have a couple of questions.

I am using a classified ad script that uses smarty templates. In the admin end of the website you can create custom fields for users advert pages. One of the fields we have created is called county here in ireland we dont use states we call them counties. So we created the field "county" as part of a multifield drop down selection. The drop down is part of a bonded field and what that means that when a user selects their county say "Louth" in the drop down in the next drop down it displays what ever towns/villages are in louth.

The makers of the software used their magic to display it on the listings page. I looked at the hard code of the template and because the field county is not hard coded I dont know how they are displaying it.

I have tried doing a bit of hard coding to retrieve the info from the database but it seems that when the info is stored in the database it has the info from the bonded fields in the one value. I cant see how the developers are stripping the unnecessary info out of the value. I will share the developers code for the page below and an image from my database showing how the info is stored.

I have tried using this code
Code:
{$listing_data.county}

But it displays the value from that database like this.
county_ireland_louth

I just need the word Louth to Display.

The word louth is displayed in the lower half of the page as you can see in the image but I just need to display it on another part of the page.

Sorry for the really long explanation. Any help would be fantastic.
Here is the code and images







Code:
<!-- listing details -->

{if !$errors}

{if $config.map_module && $location}
   <script src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false{if $smarty.const.RL_LANG_CODE != '' && $smarty.const.RL_LANG_CODE != 'en'}&language={$smarty.const.RL_LANG_CODE}{/if}"></script>
   <script>
   {literal}
   var map_data = {
      addresses: [['{/literal}{if $location.direct}{$location.direct}{else}{$location.search}{/if}', '{$location.show}', '{if $location.direct}direct{else}geocoder{/if}{literal}']],
      phrases: {
         hide: '{/literal}{$lang.hide}{literal}',
         show: '{/literal}{$lang.show}{literal}',
         notFound: '{/literal}{$lang.location_not_found}{literal}'
      },
      ready: function(base){
         base.map.set('mapTypeControl', true);
         base.map.set('mapTypeControlOptions', {
            style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
            position: google.maps.ControlPosition.BOTTOM_CENTER
         });
      },
      scrollWheelZoom: false,
      zoom: {/literal}{$config.map_default_zoom}{if $config.map_amenities && $amenities},{literal}
      localSearch: {
         caption: '{/literal}{$lang.local_amenity}{literal}',
         services: [{/literal}
            {foreach from=$amenities item='amenity' name='amenityF'}
            ['{$amenity.Key}', '{$amenity.name}', {if $amenity.Default}'checked'{else}false{/if}]{if !$smarty.foreach.amenityF.last},{/if}
            {/foreach}
         {literal}]
      }
      {/literal}{/if}{literal}
   };
   {/literal}
   </script>
{/if}
<div> {$listing.common.Fields.time_frame.value}</div>

 {if empty($price_tag_value)}
    {assign var='price_tag_value' value='No Price'}
{/if}

<div class="listing-details details {if $config.map_module && $location}loc-exists{/if}">

   {rlHook name='listingDetailsTopTpl'}
   <section class="main-section">
   
   
   
   
    <div style="padding-top:10px; padding-left:10px; padding-right:10px; height:84px; background: #F4F4F4; margin: 0 auto; position: relative;">
    <div style="height:40px;">
    <div style="float:left; padding-top:4px;"><h3 style="font-weight:bold;">{$pageInfo.name}</h3></div>
   
   
   
   
    <div style="float:right; height:34px;">
   
    <div style="padding-top:8px; height:34px; width:5px; background-image:url(http://www.cheapdeals.ie/images/price-tag-left-cheapdeals.png); background-repeat:no-repeat; float:left;"></div>
   
    <div style="height:34px; background-image:url(http://www.cheapdeals.ie/images/price-tag-center-cheapdeals.png); background-repeat:repeat-x; float:left; padding-left:5px; padding-right:5px;">
   
    <div style="padding-top:6px; font-size:18px; font-weight:bold; color:#fff; text-align:center;">{$price_tag_value|replace:'.00':''}</div>
   
   
    </div>
   
     <div style="padding-top:8px; height:34px; width:5px; background-image:url(http://www.cheapdeals.ie/images/price-tag-right-cheapdeals.png); background-repeat:no-repeat; float:right;"></div>
   
    </div>

  </div>
 
 
 
    <div style="padding-top:8px; width:100%;">
     
       
       <div style="float:left;">
     
      <div style="float:left; color:#008BD1;"><span>{$seller_info.Type_name}</span>
       <div style="float:left; padding-right:3px;"><img alt="cars for sale" height="100%" src="http://www.cheapdeals.ie/images/profile-cheapdeals.png" width="100%" /></div></div>
     
       
       </div>
       
       
       
       <div style="float:left; margin-left:15px;">
     
      <div style="float:left; color:#008BD1;">{if $config.count_listing_visits}
      <span>{$listing_data.Shows}</span> <span>{$lang.shows}</span>
       {/if}
       <div style="float:left; padding-right:3px;"><img alt="cars for sale" height="100%" src="http://www.cheapdeals.ie/images/views.png" width="100%" /></div></div>
     
       
       </div>
       
       
       
       
       </div>
 
 
 
    </div>
      <div class="top-navigation">
         

         <div class="icons">{strip}
            {if $listing_data.Account_ID == $account_info.ID}
               <a class="button low" href="{$rlBase}{if $config.mod_rewrite}{$pages.edit_listing}.html?id={$listing_data.ID}{else}?page={$pages.edit_listing}&id={$listing_data.ID}{/if}">{$lang.edit_listing}</a>
            {else}
               {rlHook name='listingDetailsNavIcons'}

               <a target="_blank" href="{$rlBase}{if $config.mod_rewrite}{$pages.print}.html?item=listing&id={$listing_data.ID}{else}?page={$pages.print}&item=listing&id={$listing_data.ID}{/if}" title="{$lang.print_page}" class="print"><span></span></a>
               <span id="fav_{$listing_data.ID}" class="favorite add" title="{$lang.add_to_favorites}"><span class="icon"></span></span>
            {/if}
         {/strip}</div>
      </div>

      {if $listing_type.Photo && $photos}
         <div class="gallery{if !$photos} no-picture{/if}">
            <script type="text/javascript">
            var fb_slideshow = {if $config.gallery_slideshow}{literal}{}{/literal}{else}false{/if};
            var fb_slideshow_delay = {if $config.gallery_slideshow_delay}{$config.gallery_slideshow_delay}*1000{else}5000{/if};

            var photos_source = new Array();
            {foreach from=$photos item='photo'}
               photos_source.push({literal} { {/literal}
                  large: '{$photo.Thumbnail}',
                  {if isset($photo.Video)}
                     href: '{if $photo.Video}{$smarty.const.RL_FILES_URL}{$photo.Video}{else}//www.youtube.com/embed/{$photo.Preview}?autoplay=1{/if}',
                     type: 'iframe',
                     local: {if $photo.Video}true{else}false{/if}
                  {else}
                     href: '{$photo.Photo}',
                     title: '{if $photo.Description}{$photo.Description|escape}{else}{$pageInfo.name|escape}{/if}',
                     type: 'image'
                  {/if}
               {literal} } {/literal});
            {/foreach}
            </script>

            <div id="media" class="gallery">
               <div class="preview{if isset($photos.0.Video)} video{/if}">
                  <iframe width="" height="" src="{if isset($photos.0.Video) && $photos.0.Type == 'youtube'}//www.youtube.com/embed/{$photos.0.Preview}?rel=0{/if}" frameborder="0" allowfullscreen></iframe>
                  <div id="player" class="hide"></div>
                  <img title="{if $photos.0.Description}{$photos.0.Description}{else}{$pageInfo.name}{/if}" src="{$rlTplBase}img/blank_10x7.gif" style="background-image: url('{$photos.0.Photo}')" />
               </div>
               <div class="map-container hide"></div>

               <div class="nav-buttons">
                  <span class="nav-button zoom">{$lang.view_larger}</span>
                  <span class="map-group">
                     <span class="nav-button gallery">{$lang.gallery}</span>
                     {if $config.map_module && $location}
                        <span class="nav-button map">{$lang.map}</span>
                     {/if}
                     {if $aHooks.street_view}
                        <span class="nav-button street-view">{$lang.street_view_tab}</span>
                     {/if}
                  </span>
               </div>
            </div>

            {math assign='slides' equation='ceil(count/(rows*cols))' cols=$config.pg_previewbox_cols rows=$config.pg_previewbox_rows count=$photos|@count}
            {assign var='per_slide' value=$config.pg_previewbox_cols*$config.pg_previewbox_rows}
            <div class="thumbs{if $photos|@count == 1} hide{/if}">
               <div title="{$lang.prev}" class="prev disabled"></div>
               <div title="{$lang.next}" class="next"></div>
               <div class="slider">
                  <ul class="swiper-wrapper">
                     {foreach from=$photos item='photoItem' name='photosF'}{strip}
                     <li class="swiper-slide{if $smarty.foreach.photosF.first} active{/if}{if isset($photoItem.Video)} video{/if}">
                        <img title="{if $photoItem.Description}{$photoItem.Description}{else}{$pageInfo.name}{/if}" alt="{if $photoItem.Description}{$photoItem.Description}{else}{$pageInfo.name}{/if}" src="{$rlTplBase}img/blank_10x7.gif" style="background-image: url('{$photoItem.Thumbnail}');" />{if isset($photoItem.Video)}<span class="play"></span>{/if}
                     </li>
                     {/strip}{/foreach}
                  </ul>
               </div>
            </div>
         </div>
      {/if}
   </section>

   <section class="content-section clearfix">
      <!-- tabs -->
      {php}
         global $listing_type, $photos;

         if ($listing_type.Photo && $photos) {
            $tabs = $this -> get_template_vars('tabs');
            unset($tabs['streetView']);
            $this -> assign('tabs', $tabs);
         }
      {/php}

      {if $tabs|@count > 1}
         <ul class="tabs">
            {foreach from=$tabs item='tab' name='tabF'}{strip}
               <li {if $smarty.foreach.tabF.first}class="active"{/if} id="tab_{$tab.key}">{$tab.name}</li>
            {/strip}{/foreach}
         </ul>
      {/if}
      <!-- tabs end -->

      <!-- listing details -->
      <div id="area_listing" class="tab_area">
         <h1>{$pageInfo.name}</h1>

         <div class="two-inline clearfix">
            <!-- price tag -->
            {if $price_tag_value}
               <div class="price-tag" id="df_field_price"><span>{$price_tag_value}</span> {if $listing_data.sale_rent == 2}/ {$listing.common.Fields.time_frame.value}{/if}</div>
            {/if}
            <!-- price tag end -->

            {if $listing.common.Fields.bedrooms.value || $listing.common.Fields.bathrooms.value || $listing.common.Fields.square_feet.value}
               <ul class="ad-info">
                  <li class="services">{strip}
                     {if $listing.common.Fields.bedrooms.value}
                        <span title="{$listing.fields.bedrooms.name}" class="badrooms">{$listing.common.Fields.bedrooms.value}</span>
                     {/if}
                     {if $listing.common.Fields.bathrooms.value}
                        <span title="{$listing.fields.bathrooms.name}" class="bathrooms">{$listing.common.Fields.bathrooms.value}</span>
                     {/if}
                     {if $listing.common.Fields.square_feet.value}
                        <span title="{$listing.fields.square_feet.name}" class="square_feet">{$listing.common.Fields.square_feet.value}</span>
                     {/if}
                  {/strip}</li>
               </ul>
            {/if}
         </div>
      
         {rlHook name='listingDetailsPreFields'}

         {foreach from=$listing item='group'}
            <div {if $group.Key == 'common'}class="row"{/if}>
               {if $group.Group_ID && $group.Key != 'common'}
                  {assign var='hide' value=false}
                  {if !$group.Display}
                     {assign var='hide' value=true}
                  {/if}
            
                  {assign var='value_counter' value='0'}
                  {foreach from=$group.Fields item='group_values' name='groupsF'}
                     {if $group_values.value == '' || !$group_values.Details_page}
                        {assign var='value_counter' value=$value_counter+1}
                     {/if}
                  {/foreach}
            
                  {if !empty($group.Fields) && ($smarty.foreach.groupsF.total != $value_counter)}
                     {include file='blocks'|cat:$smarty.const.RL_DS|cat:'fieldset_header.tpl' id=$group.ID name=$group.name hide=$hide}
                     
                     {foreach from=$group.Fields item='item' key='field' name='fListings'}
                        {if !empty($item.value) && $item.Details_page}
                           {include file='blocks'|cat:$smarty.const.RL_DS|cat:'field_out.tpl'}
                        {/if}
                     {/foreach}
                     
                     {include file='blocks'|cat:$smarty.const.RL_DS|cat:'fieldset_footer.tpl'}
                  {/if}

                  {assign var='main_section_no_group' value=false}
               {else}
                  {if $group.Fields}
                     {foreach from=$group.Fields item='item'}
                        {if !empty($item.value) && $item.Details_page}
                           {include file='blocks'|cat:$smarty.const.RL_DS|cat:'field_out.tpl'}
                        {/if}
                     {/foreach}
                  {/if}
               {/if}
            </div>
         {/foreach}

         <!-- statistics area -->
         <section class="statistics clearfix">
            <ul class="controls">
               <li>
                  <!-- AddThis Button BEGIN -->
                  <div class="addthis_toolbox addthis_default_style addthis_32x32_style">
                  <a class="addthis_button_preferred_1"></a>
                  <a class="addthis_button_preferred_2"></a>
                  <a class="addthis_button_preferred_3"></a>
                  <a class="addthis_button_preferred_4"></a>
                  <a class="addthis_button_compact"></a>
                  <a class="addthis_counter addthis_bubble_style"></a>
                  </div>
                  <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=xa-52d66a9b40223211"></script>
                  <!-- AddThis Button END -->
               </li>
               {rlHook name='listingDetailsAfterStats'}
            </ul>
            <ul class="counters">
               {if $config.count_listing_visits}<li><span class="count">{$listing_data.Shows}</span> {$lang.shows}</li>{/if}
               {if $listing_data.comments_count}<li><a href="#comments"><span class="count">{$listing_data.comments_count}</span> {$lang.comment_tab}</a></li>{/if}
               {rlHook name='listingDetailsCounters'}
            </ul>
         </section>
         <!-- statistics area end -->
      </div>
      <!-- listing details end -->   

      <!-- tell a friend tab -->
         <div id="area_tell" class="tab_area hide">
            <div class="content-padding">
               <div class="submit-cell">
                  <div class="name">{$lang.friend_name} <span class="red">*</span></div>
                  <div class="field"><input class="wauto" type="text" id="friend_name" maxlength="50" size="30" value="{$smarty.post.friend_name}" /></div>
               </div>

               <div class="submit-cell">
                  <div class="name">{$lang.friend_email} <span class="red">*</span></div>
                  <div class="field"><input class="wauto" type="text" id="friend_email" maxlength="50" size="30" value="{$smarty.post.friend_email}" /></div>
               </div>

               <div class="submit-cell">
                  <div class="name">{$lang.your_name}</div>
                  <div class="field"><input class="wauto" type="text" id="your_name" maxlength="100" size="30" value="{$account_info.Full_name}" /></div>
               </div>

               <div class="submit-cell">
                  <div class="name">{$lang.your_email}</div>
                  <div class="field"><input class="wauto" type="text" id="your_email" maxlength="30" size="30" value="{$account_info.Mail}" /></div>
               </div>

               <div class="submit-cell">
                  <div class="name">{$lang.message}</div>
                  <div class="field"><textarea id="message" rows="6" cols="50">{$smarty.post.message}</textarea></div>
               </div>

               {if $config.security_img_tell_friend}
               <div class="submit-cell">
                  <div class="name">{$lang.security_code} <span class="red">*</span></div>
                  <div class="field">
                     {include file='captcha.tpl' no_caption=true}
                  </div>
               </div>
               {/if}

               <div class="submit-cell buttons">
                  <div class="name"></div>
                  <div class="field"><input onclick="xajax_tellFriend($('#friend_name').val(), $('#friend_email').val(), $('#your_name').val(), $('#your_email').val(), $('#message').val(), $('#security_code').val(), '{$print.id}');$(this).val('{$lang.loading}');" type="button" name="finish" value="{$lang.send}" /></div>
               </div>
            </div>
         </div>
         <!-- tell a friend tab end -->

      <!-- tabs content -->
      {rlHook name='listingDetailsBottomTpl'}
      <!-- tabs content end -->   
   </section>

   <script type="text/javascript">
   {if isset($smarty.get.highlight)}
      flynaxTpl.highlightResults("{$smarty.session.keyword_search_data.keyword_search}", true);
   {/if}

   var ld_inactive = {if $pageInfo.Listing_details_inactive}'{$lang.ld_inactive_notice}'{else}false{/if};

   {literal}
   $(document).ready(function(){
      if ( ld_inactive ) {
         printMessage('warning', ld_inactive, false, true);
      }
      
      if ( $('#df_field_vin .value').length > 0 ) {
         var html = '<a style="font-size: 14px;" href="javascript:void(0);">{/literal}{if $lang.check_vin}{$lang.check_vin}{else}Check Vin{/if}{literal}</a>';
         var vin = $('#df_field_vin .value').html();
         var frame = '<iframe scrolling="auto" height="600" frameborder="0" width="100%" src="http://www.carfax.com/cfm/check_order.cfm?vin='+vin+'" style="border: 0pt none;overflow-x: hidden; overflow-y: auto;background: white;"></iframe>';
         
         $('#df_field_vin .value').append(html);
         
         $('#df_field_vin .value a').flModal({
            content: frame,
            width: 900,
            height: 640
         });
      }
   });
   {/literal}
   </script>
</div>
{else}
   <!-- TODO HERE -->
{/if}

<!-- listing details end -->








[img]http://postimg.org/image/41mv23qf7/[/img]

[img]http://postimg.org/image/g6bwmd3tj/[/img][/code]
Back to top
View user's profile Send private message
aidendoyle1981
Smarty Rookie


Joined: 11 Jan 2016
Posts: 9

PostPosted: Thu Jan 14, 2016 12:31 am    Post subject: fixed Reply with quote

Didn't really expect an answer to this as it was a bit long winded. But how and ever I got it sorted myself.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP