Jump to content

Recommended Posts

Hi,i have a website but having some problems here  :'(

 

this is the link to my site : http://www.mycars.com.my/Auto/display_listing/508/1997_Perodua_Kancil.html

 

kindly look at the "Description" whereby i have problem spacing the sentences,i wish to put them into few lines but i failed even after hitting the "enter" button for few times,it doesn't seem to work.

 

any idea?

Link to comment
https://forums.phpfreaks.com/topic/240130-need-help/
Share on other sites

I'm assuming you entered the text for that description in a textarea? text areas use newline characters to denote when you go to the next line (the character: \n)

 

luckily, php has a function, nl2br which converts newlines to their html equivalent (line breaks, or the <br /> tag)

Link to comment
https://forums.phpfreaks.com/topic/240130-need-help/#findComment-1233452
Share on other sites

Here is my TPL.File  .i highlight in red colour is the code to display the text.

 

<table>

<tr><td colspan="3" style="font-size:160%">
<span class="listInfoYearMakeModel">{$listing.Year} | [[$listing.MakeModel.Make]] [[$listing.MakeModel.Model]]</span>  <span class="listInfoPrice">{$GLOBALS.custom_settings.listing_currency} [[$listing.Price]]</span>


{$form_fields.Location.caption}:</b> {$listing.Location}</
</td></tr>

<tr><td height="2"></td></tr>

<tr><td valign="top">

{if $listing.pictures.0}{include file="listing_images.tpl" listing=$listing}</td><td valign="top">{/if}

   <div style="padding:5px;padding-top:0;color:#4E7391;font-size:140%;font-weight:bold">[[Car details]]</div>
   <table cellpadding="5">
   <tr><td><b>[[FormFieldCaptions!Listing ID]]:</b> {$listing.id}</td></tr>
   <tr><td><b>[[FormFieldCaptions!Price]]:</b> {$GLOBALS.custom_settings.listing_currency} [[$listing.Price]]</td></tr>
   <tr><td><b>[[FormFieldCaptions!Body Style]]:</b> [[$listing.BodyStyle]]</td></tr>
   <tr><td><b>{$form_fields.EngineCapacity.caption}:</b> {$listing.EngineCapacity}</td></tr>
   <tr><td><b>[[FormFieldCaptions!Mileage]]:</b> [[$listing.Mileage]]</td></tr>
   <tr><td><b>[[FormFieldCaptions!Exterior Color]]:</b> [[$listing.ExteriorColor]]</td></tr>
   <tr><td><b>[[FormFieldCaptions!Interior Color]]:</b> [[$listing.InteriorColor]]</td></tr>
   <tr><td><b>[[FormFieldCaptions!Engine]]:</b> [[$listing.Engine]]</td></tr>
   <tr><td><b>[[FormFieldCaptions!Transmission]]:</b> [[$listing.Transmission]]</td></tr>
   <tr><td><b>[[FormFieldCaptions!Drive Type]]:</b> [[$listing.DriveType]]</td></tr>
   <tr><td><b>[[FormFieldCaptions!Doors]]:</b> [[$listing.Doors]]</td></tr>
   <tr><td><b>[[FormFieldCaptions!Fuel Type]]:</b> [[$listing.FuelType]]</td></tr>
   <tr><td><b>[[FormFieldCaptions!VIN]]:</b> [[$listing.Vin]]</td></tr>
   {if $listing.Video.file_url}
   <tr><td><a target="VideoPlayer" onclick='javascript:window.open(this.href, "VideoPlayer", "width=300,height=300,top=100")' href="{$GLOBALS.site_url}/video_player/?listing_id={$listing.id}">[[Watch a video]]</a></td></tr>
   {/if}
   {if $listing.Vin}
   <tr><td><a href="http://www.carfax.com/cfm/check_order.cfm?vin={$listing.Vin}">[[View the CARFAX Vehicle History Report]]</a></td></tr>
   {/if}
   </table>

</td><td valign="top">
   <div style="padding:2px;padding-top:0;color:#4E7391;font-size:140%;font-weight:bold">[[seller Info]]:</div>
   <table style="padding-top:4px">
   <tr><td><b>{$listing.user.FirstName}   {$listing.user.LastName}</b></td></tr>

   <tr><td>{$listing.user.PhoneNumber}</td></tr>

   {if $listing.user.DisplayEmail eq 1 }
   <tr><td><a href="mailto:{$listing.user.email}">{$listing.user.email}</a></td></tr>
   {/if}

   <tr><td><a href="http://{$listing.user.DealershipWebsite}">{$listing.user.DealershipWebsite}</a></td></tr>

   {if $listing.user.DealershipLogo.file_url}
   <tr><td><img src="{$listing.user.DealershipLogo.file_url}" alt="" /></td></tr>
   {/if}
   <tr><td><a  target="ContactSeller" onclick='javascript:window.open(this.href, "ContactSeller", "width=270,height=300,top=0")' href="{$GLOBALS.site_url}/contact_seller/?listing_id={$listing.id}">[[Contact seller]]</a></td></tr>

   <tr><td><a href="{$GLOBALS.site_url}/search_results/?action=search&username[equal]={$listing.user.username}">[[All ads by this seller]]</a></td></tr>

   <tr><td></td></tr>
   <tr><td>[[FormFieldCaptions!Listing Views]]: [[$listing.views]]</td></tr>

   </table>
</td></tr>
</table>

<table style="padding-left:10px" cellpadding="0" cellspacing="0">
<tr><td>
   <b>[[Features]]:</b>
   {strip}
   {assign var=comma value=false}
   {if $listing.CompactDiscPlayer}[[$form_fields.CompactDiscPlayer.caption]]{assign var=comma value=true}{/if}
   {if $listing.CruiseControl}   {if $comma}, {/if}[[$form_fields.CruiseControl.caption]]{assign var=comma value=true}{/if}
   {if $listing.LeatherSeats}   {if $comma}, {/if}[[$form_fields.LeatherSeats.caption]]{assign var=comma value=true}{/if}
   {if $listing.PowerDoorLocks}{if $comma}, {/if}[[$form_fields.PowerDoorLocks.caption]]{assign var=comma value=true}{/if}
   {if $listing.PowerMirrors}   {if $comma}, {/if}[[$form_fields.PowerMirrors.caption]]{assign var=comma value=true}{/if}
   {if $listing.PowerWindows}   {if $comma}, {/if}[[$form_fields.PowerWindows.caption]]{assign var=comma value=true}{/if}
   {if $listing.RearWindowDefroster}{if $comma}, {/if}[[$form_fields.RearWindowDefroster.caption]]{assign var=comma value=true}{/if}
   {if $listing.DriverAirBag}   {if $comma}, {/if}[[$form_fields.DriverAirBag.caption]]{assign var=comma value=true}{/if}
   {if $listing.TiltWheel}      {if $comma}, {/if}[[$form_fields.TiltWheel.caption]]{assign var=comma value=true}{/if}
   {if $listing.TintedGlass}   {if $comma}, {/if}[[$form_fields.TintedGlass.caption]]{/if}
   {/strip}
</td></tr>
<tr><td height="10">
</td></tr>
<tr><td>
   <b>[[FormFieldCaptions!Description]]:</b> {$listing.SellerComments}
</td></tr></table>

 

MOD EDIT: code tags added.

Link to comment
https://forums.phpfreaks.com/topic/240130-need-help/#findComment-1233467
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.