How to break line in an XML Feed according to page width?

Asked

Viewed 150 times

3

I have a table with 15 items and I need to break the columns when the total size of the items reaches the total width of the table.

Ex.:

What’s going on:

|--- WIDTH 300px ---|

01 02 03 04 05 06 07 08 09 10 11 12 13 14 15

What I need done:

|--- WIDTH 300px ---|

01 02 03 04 05 06

07 08 09 10 11 12

13 14 15

I have this feed as example and my current code is this:

<div style="width:300px; max-width:300px">
    <?php
       $a = file_get_contents("http://v2.afilio.com.br/aff/aff_boutique_show_ads.php?boutiqueid=37930-895843&currencypos=0&display_img=1&diplay_name=1&diplay_price=1&thumbsize=80%&truncate_desc=15&numrows=1&numcols=20&colorname=000000&colorprice=E30000&bkcolor=FFFFFF&bordercolor=FFFFFF&self_target=0&");
       echo ($a);
    ?>    
</div>

I would also like to know, it is possible to use Javascript instead of PHP?

  • Mathew, in what sense would you like to use Javascript instead of PHP?

1 answer

1

Mathew,

Actually you can solve by simply adding the style word-wrap: break-word; in your div.

Example, I put 120px to give the result of your example:

<div style="width:120px;word-wrap: break-word; max-width:120px">
    <p>
    01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
    </p>
</div>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.