carlosx2 Posted October 8, 2009 Share Posted October 8, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/176981-divs-and-php/ Share on other sites More sharing options...
carlosx2 Posted October 8, 2009 Author Share Posted October 8, 2009 any one who can help me out here? Quote Link to comment https://forums.phpfreaks.com/topic/176981-divs-and-php/#findComment-933177 Share on other sites More sharing options...
jon23d Posted October 8, 2009 Share Posted October 8, 2009 Try array_chunk. Quote Link to comment https://forums.phpfreaks.com/topic/176981-divs-and-php/#findComment-933186 Share on other sites More sharing options...
carlosx2 Posted October 8, 2009 Author Share Posted October 8, 2009 can you elaborate on that? don't really get it. Quote Link to comment https://forums.phpfreaks.com/topic/176981-divs-and-php/#findComment-933242 Share on other sites More sharing options...
deived Posted October 8, 2009 Share Posted October 8, 2009 Everything looks alright. Maybe something in the output is breaking the HTML? Do you have this on a host right now where we can see what it looks like? Quote Link to comment https://forums.phpfreaks.com/topic/176981-divs-and-php/#findComment-933245 Share on other sites More sharing options...
carlosx2 Posted October 8, 2009 Author Share Posted October 8, 2009 well its a paid members area that is running this. its just the way its printing out the links. really a pain to get it properly styled. so maybe i should be looking more in the direction on css as the problem then php not sure Quote Link to comment https://forums.phpfreaks.com/topic/176981-divs-and-php/#findComment-933260 Share on other sites More sharing options...
mikesta707 Posted October 8, 2009 Share Posted October 8, 2009 yes, its a CSS problem, not a PHP problem Quote Link to comment https://forums.phpfreaks.com/topic/176981-divs-and-php/#findComment-933264 Share on other sites More sharing options...
deived Posted October 8, 2009 Share Posted October 8, 2009 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); Quote Link to comment https://forums.phpfreaks.com/topic/176981-divs-and-php/#findComment-933268 Share on other sites More sharing options...
carlosx2 Posted October 8, 2009 Author Share Posted October 8, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/176981-divs-and-php/#findComment-933293 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.