I am trying to edit my blog which is using PHP. I want to put together mutliple if statements to do what i want. So i would like some help as i can't figure it out at all. I will need to email you the code from my site so if you can pm me your email address i can explain properly. Thanks
Is that sarcasm?! I have already looked it up and i know how it works but my website is a template, i did not make it and i dont know which parts of it are the if statement and which are code for searching for the information. I need the help combining the statement with my website content as i dont want to mess it all up
you could also use elseif... http://us3.php.net/manual/en/control-structures.elseif.php You can also have a look into switch statements, that can call a function. http://us3.php.net/manual/en/control-structures.switch.php switch ($do) { case "edit": doEdit(); break; case "delete": doDelete(); break; default: doList(); } function doEdit() { } // ect... PHP: There is a lot more to it than this, but the idea is there,
No they're not. They can sometimes produce unexpected behaviour, but any programmer worth the money you're paying them will understand it fully. Dan.
So the real problem here, if I'm reading correctly, isn't with IF statements- it is with documentation. I believe the OP stated he just wants to find out which IF statements belong where. This is somewhat of a long process, but go through each open bracket and closed bracket and label them with a comment. Example below: if (!know()) { //start if statement for knowledge read('Manual'); } else { //if there isn't any knowledge about the subject, do this fail(); } //end if statement for knowledge PHP: Doing this will make your code much more readable. There are also cleaner ways to do so, if you want to take it further. Sorry if I read this wrong, just seemed like a lack of documentation to me.
Problem is, if you don`t know programming, you can`t expect people here to teach you. You need to give alot more info then "I`m editing a template", since a coder can see that as a smarty template, or just a plain html template etc.
I dont know programming but I am not asking people to teach me. I am taking it one step at a time but this seems well above me and i know my limits. kjmcculloch has given me some help to get me working on it so thank you for that. Basically on my blog it shows the most recent post along with a picture. What i wanted to do was put a code in so depending on what category the post was filed under determined what photo would show and when i was looking around it seemed an if statement would do the trick. I also wanted to know how to edit a bit of code which showed a "fetaured post" article as this wasnt showing up. All the files are php and for a beginner it is difficult trying to read the code
Isn't it obvious if you don't know how it works, then how will you edit it. This is not like high school maths, stuck on a question, turn back of textbook for answer. If you don't put effort in learning, sorry to say that you won't succeed.