CodeWalrus

Development => Web => Topic started by: Jokeriske on March 27, 2016, 07:07:10 PM

Title: php error
Post by: Jokeriske on March 27, 2016, 07:07:10 PM
hey, im getting this error when i try to list all files in a dir and make them clickable and redirect it to the file wich is clicked.

this is the error : Parse error: syntax error, unexpected ''>'' (T_CONSTANT_ENCAPSED_STRING), expecting ',' or ';' in /var/www/html/admin/uploads/index.php on line 17

this is the code im using :



$files=glob("*.{png,jpg,gif,mp3,mp4}",GLOB_BRACE);
$fileCount = count($files);

for ($i = ($fileCount-1); $i >= 0; $i--) { 
    echo '<center><a href='.$files'>'.$files'<img src='.$files[$i].' id="rcorners2" alt="" width="200px"></center></a>';
echo '</br>';
echo '</br>';
echo '</br>';
}


page_end();
?>


im noob in php i know, ive tried to google and understand the basics for php but this is a little bit above my level :/
Title: Re: php error
Post by: Jokeriske on March 27, 2016, 07:48:33 PM
Problem solved, please lock this :)
Title: Re: php error
Post by: Dream of Omnimaga on March 27, 2016, 08:44:09 PM
What was the issue, by the way? Also @Juju once made an image gallery for img.codewalr.us but he lost the code. He could probably have helped you as well. Or are you trying to make an avatar that changes every page load? I'm not familiar with PHP so I can't really understand most of the code.
Title: Re: php error
Post by: Yuki on March 27, 2016, 08:58:49 PM
Please tell how you solved it, so others can see what was wrong.
Title: Re: php error
Post by: Jokeriske on March 28, 2016, 03:35:49 PM
i used
echo '<center><a href='.$files'>'.$files'<img src='.$files[$i].' id="rcorners2" alt="" width="200px"></center></a>';

instead of
echo '<center><a href='.$files[$i].'><img src='.$files[$i].' id="rcorners2" alt="" width="200px"></center></a>';
Title: Re: php error
Post by: Dream of Omnimaga on March 28, 2016, 08:02:16 PM
I see. I noticed that PHP can be picky when I did some SMF theme editing. X.x
Title: Re: php error
Post by: Jokeriske on March 29, 2016, 11:01:57 AM
Yeah but php is fun to code with
Title: Re: php error
Post by: Dream of Omnimaga on March 29, 2016, 03:15:57 PM
I don't like it much, but it still does the job very well so I cope with it when I need to do minor changes to something. I really need to learn it thoroughly at some point, though, so I can do more theme editing or even custom pages.
Title: Re: php error
Post by: Jokeriske on March 29, 2016, 06:58:38 PM
Quote from: DJ Omnimaga on March 29, 2016, 03:15:57 PM
I don't like it much, but it still does the job very well so I cope with it when I need to do minor changes to something. I really need to learn it thoroughly at some point, though, so I can do more theme editing or even custom pages.


are you going to change the theme? the way it is now is awesome
Title: Re: php error
Post by: Dream of Omnimaga on March 29, 2016, 07:01:48 PM
Nah, I don't want to change it now, especially considering when we upgrade to SMF 2.1 (when it comes out, that is) we will have to redo the entire theme from scratch and lose every feature provided by SMF plugins that only runs on SMF 1.1 and 2.0. The potential loss of features could be another reason for learning PHP, by the way. :P
Title: Re: php error
Post by: Jokeriske on March 30, 2016, 07:13:02 PM
Quote from: DJ Omnimaga on March 29, 2016, 07:01:48 PM
Nah, I don't want to change it now, especially considering when we upgrade to SMF 2.1 (when it comes out, that is) we will have to redo the entire theme from scratch and lose every feature provided by SMF plugins that only runs on SMF 1.1 and 2.0. The potential loss of features could be another reason for learning PHP, by the way. :P

yeah :P , are there alot of new features?
Title: Re: php error
Post by: Dream of Omnimaga on March 30, 2016, 07:24:35 PM
I don't remember the highlights. The main change is that the theme is purposely made to be mobile-friendly and I often heard that the code is optimized much better. It's also open-source and on Github now, unlike previous versions of SMF which were coded by a specific team. But I hope that's not all there is in SMF 2.1 (although it would definitively make porting mods much easier).