1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP If statement help required

Discussion in 'PHP' started by influx08, Jan 21, 2009.

  1. #1
    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
     
    influx08, Jan 21, 2009 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    Kaizoku, Jan 21, 2009 IP
    Funk-woo10 likes this.
  3. influx08

    influx08 Guest

    Messages:
    72
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    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
     
    influx08, Jan 21, 2009 IP
  4. kjmcculloch

    kjmcculloch Well-Known Member

    Messages:
    850
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    108
    #4
    If you send me the code I'll have a look
     
    kjmcculloch, Jan 21, 2009 IP
  5. tarponkeith

    tarponkeith Well-Known Member

    Messages:
    4,758
    Likes Received:
    279
    Best Answers:
    0
    Trophy Points:
    180
    #5
    tarponkeith, Jan 21, 2009 IP
  6. InovvativeTech

    InovvativeTech Banned

    Messages:
    32
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Great Tutorial
     
    InovvativeTech, Jan 21, 2009 IP
  7. Zytran

    Zytran Member

    Messages:
    22
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #7
    Zytran, Jan 21, 2009 IP
  8. fatedesign

    fatedesign Peon

    Messages:
    38
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Do the user above, you should only use switches for numbers. They are unstable with strings.
     
    fatedesign, Jan 21, 2009 IP
  9. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #9
    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.
     
    Danltn, Jan 22, 2009 IP
  10. zac439

    zac439 Notable Member

    Messages:
    3,074
    Likes Received:
    214
    Best Answers:
    0
    Trophy Points:
    260
    #10
    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.
     
    zac439, Jan 22, 2009 IP
  11. t3nt3tion

    t3nt3tion Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    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.
     
    t3nt3tion, Jan 22, 2009 IP
  12. influx08

    influx08 Guest

    Messages:
    72
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #12
    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
     
    influx08, Jan 23, 2009 IP
  13. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #13
    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.
     
    Kaizoku, Jan 23, 2009 IP
  14. mrmaf

    mrmaf Peon

    Messages:
    41
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Sent me PM!
     
    mrmaf, Jan 23, 2009 IP