Jump to content

Recommended Posts

i have trying to get the out put of my php script to show up in divs side by side, but it ain't working. I can so easily do this when its just html and css but when it comes to php it is not working.

 

this is the code

<div class='wrapper'>
<?php
echo '<link href="path/style.css" rel="stylesheet" type="text/css">';

$model = $_GET['id'];
$id = 1;
$modelname = split(':', $model);

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


echo "<div class='table1'>";
if($id <= 5){
    echo "save movie <a href='$filename'>part: $id</a><br />";
$id++;

	}
echo " </div>";

	echo "<div class='table2'>";

if($id >= 6){

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

}


?>
</div>

 

this is the css code

div.wrapper{

width:500px;
position:relative;
clear:both;
}

div.table1{
width:50%;
position:relative;

}

div.table2{
width:50%;
position:relative;
right:200;
}

 

I even tried to split up the code but then i am not getting the right result.

 

My script has to show 5 movies in div one then 5 in div two and then 5 in div and so on. or 10 in one and 10 in div two.

 

Anyway i need to find a way to just echo out the results in different divs. even better if i could just echo them anywhere i like. But i have no idea how something like this is done.

 

Maybe some can help me out and shine some light on this. 

 

Second question. I wanted to use the split function as i am using the get function to extract a name from the url. the only thing is that name i get is something 243:fast car now i want to keep the name fast car but be able to lose everything in front of the : plus also the : then i need to use that value in the path that is going to extract the movie from the folder.

 

It can to my attention that the split function i wanted to use is no longer being used in php 5. What should i do now and how.

 

Thanks. hope some one can show me how i could get this to work. Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/176981-divs-and-php/
Share on other sites

That's what I'm thinking.  the PHP looks like it should be outputting the HTML properly, so it might be the CSS.  Try adjusting your positions and floats.  I usually have a hard time working with positioning.  If you want the two tables to be next to each other, I would usually put a float left or right on both of the tables, then put an empty div to clear them both before making the next two tables below it (if your having more than the 2 tables);

Link to comment
https://forums.phpfreaks.com/topic/176981-divs-and-php/#findComment-933268
Share on other sites

well this is the problem. it used to work with floating and position but then i did a test how it would work with different numbers of links and i saw that it would not work the way i wanted to work. it would screw up the whole out put.

 

Well i will try to figure out the css part.thanks

Link to comment
https://forums.phpfreaks.com/topic/176981-divs-and-php/#findComment-933293
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.