Why this page keeps loading? |
[eluser]behnampmdg3[/eluser]
Hello; This script reads files from a directory and shows the names. It works fine, shows all the content properly but it keeps loading the page over and over (the browser reload botton keeps turning). What am I doing wrong? Should I somehow close the foreach or something like that? Thanks Code: $directory_url = "/home/nickdavi/public_html/upload/server/php/files/thumbnail";
[eluser]PhilTem[/eluser]
1) Directories should always contain a trailing slash => Code: $directory_url = "/home/nickdavi/public_html/upload/server/php/files/thumbnail/"; 2) I don't have any other idea expect that you maybe have thousands of files in that directory and it takes some time echoing the links/images
[eluser]behnampmdg3[/eluser]
[quote author="PhilTem" date="1358019887"]1) Directories should always contain a trailing slash => Code: $directory_url = "/home/nickdavi/public_html/upload/server/php/files/thumbnail/"; 2) I don't have any other idea expect that you maybe have thousands of files in that directory and it takes some time echoing the links/images [/quote]Hello; I added the slash but it didn't work. /home/nickdavi/public_html/sincity/website_admin/upload/server/php/files/thumbnail/ There are about 15 files in the folder.
[eluser]CroNiX[/eluser]
Why all of the opening/closing php tags within the loop? Try using php alternative syntax. Code: $files = directory_map($directory_url); Also note that your margin-right isn't in any sort of a style tag and it's missing a quote...which is probably your real problem because you aren't outputting valid HTML. It should probably be: Code: <img src="/files/thumbnail/<?php echo $photo;?>" />
[eluser]CroNiX[/eluser]
nevermind, this forum software is eating part of the post so I can't write it as it should be. Nice.
[eluser]behnampmdg3[/eluser]
[quote author="CroNiX" date="1358029149"]nevermind, this forum software is eating part of the post so I can't write it as it should be. Nice.[/quote]Didn't work but thank you for your help. I changed it to what you suggested but still the same! Code: <?php
[eluser]InsiteFX[/eluser]
Because you should have the files code in your controller then pass them to the view using $data then use the foreach loop to display them.
[eluser]behnampmdg3[/eluser]
[quote author="InsiteFX" date="1358031522"]Because you should have the files code in your controller then pass them to the view using $data then use the foreach loop to display them. [/quote]Hey thanks but it didn't work! View Code: <?php foreach($files as $photo): ?> Code: $this->load->helper('directory'); Thanks |
Welcome Guest, Not a member yet? Register Sign In |