The shoutbox is currently out of service. Join us on Discord instead.
You can help CodeWalrus stay online by donating here.

php error

Started by Jokeriske, March 27, 2016, 07:07:10 pm

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jokeriske

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 :/

Jokeriske

Problem solved, please lock this :)

DJ Omnimaga

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.

Juju

Please tell how you solved it, so others can see what was wrong.
Read Zarmina!
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron



if you wanna throw money at me and/or CodeWalrus monthly it's here

Jokeriske

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>';

DJ Omnimaga

I see. I noticed that PHP can be picky when I did some SMF theme editing. X.x

Jokeriske

Yeah but php is fun to code with

DJ Omnimaga

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.

Jokeriske

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

DJ Omnimaga

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

Jokeriske

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?

DJ Omnimaga

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).

Powered by EzPortal