Jump to content

array echo styling


carlosx2

Recommended Posts

Hi All.

 

This is my first post on this forum. i have just taken on php as i thought it would be really good for me to also code a bit myself, as i run quite a lot sites.

 

Its not really hard but some something are so hard to figure out when you just start with php. I am sure my question is very noob and way ti easy for you guys but i can't figure it out.

 

<?php

 

$id = 1;

 

foreach (glob("path*.wmv") as $filename) {

 

    echo "Right click and save movie <a href='$filename'>part: $id</a><br>";

$id++;

}

 

 

 

?>

 

now i would like to have video 1 to 5 echo out in the left column and 5 -10 in the second and so and so on.

 

But i have no idea if i should make a loop that first divides the first around in 3 other arrays and print those out or if i can just print out three columns with just one array.

 

Also i have no idea how it is called so the last few days i have just been searching stuff with random search strings to see if i can find something but seems that ain't working.

 

Link to comment
https://forums.phpfreaks.com/topic/176829-array-echo-styling/
Share on other sites

What I would do is

$This = "<tr>";

if($id <= 5)

{

if($id == 1)

{

$This = "<tr>";

}

 

$This .= "Right click and save movie <a href='$filename'>part: $id</a><br>";

}

else

{

$This .= "</tr>";

echo $This;

$id = 1;

$This = "";

}

[/code]

 

Inside table tags

Link to comment
https://forums.phpfreaks.com/topic/176829-array-echo-styling/#findComment-932326
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.