cowboysdude Posted August 23, 2009 Share Posted August 23, 2009 This is what I'm trying to do... grab a variable and if it's true then show the following... <?php If ($v1=="1") { echo { "<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/". $vid1 . > </a> </div>" } Else {echo (""); } } ?> I can't get it to work.. it just won't load the page. Question is how do I format this to work? Thanks Quote Link to comment Share on other sites More sharing options...
Zoofu Posted August 23, 2009 Share Posted August 23, 2009 <?php If ($v1=="1") { echo { "<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/". $vid1 . > </a> </div>" }else { echo " "; } } ?> And I think .$vid1. needs to be ".$vid1." Quote Link to comment Share on other sites More sharing options...
oni-kun Posted August 23, 2009 Share Posted August 23, 2009 What? That's code is written poorly.. look up the echo and you'll note the construct formatting you should be doing with your if statements etc. <?php If ($v1=="1") { echo '<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/'. $vid1 . '"> </a> </div>' } Else { echo ""; //No need for this Else really.. } ?> Should work.. Note you can only store double quotes ( " ) in a single quote.. such as echo ' This " are "" quotes "" '; , anything else will fail. Quote Link to comment Share on other sites More sharing options...
cowboysdude Posted August 24, 2009 Author Share Posted August 24, 2009 What? That's code is written poorly.. look up the echo and you'll note the construct formatting you should be doing with your if statements etc. <?php If ($v1=="1") { echo '<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/'. $vid1 . '"> </a> </div>' } Else { echo ""; //No need for this Else really.. } ?> Should work.. Note you can only store double quotes ( " ) in a single quote.. such as echo ' This " are "" quotes "" '; , anything else will fail. OH I know it's bad that's why I was asking for help..LOL Thank you!! <?php If ($v1=="1") { echo { "<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/". $vid1 . > </a> </div>" }else { echo " "; } } ?> And I think .$vid1. needs to be ".$vid1." Great idea ... still not working.. But Thank you!!! Quote Link to comment Share on other sites More sharing options...
oni-kun Posted August 24, 2009 Share Posted August 24, 2009 Try this code, forgot to add the ;.. <?php If ($v1=="1") { echo '<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/'. $vid1 . '"> </a> </div>'; } ?> Quote Link to comment Share on other sites More sharing options...
cowboysdude Posted August 24, 2009 Author Share Posted August 24, 2009 Try this code, forgot to add the ;.. <?php If ($v1=="1") { echo '<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/'. $vid1 . '"> </a> </div>'; } ?> Well the page now loads the overlay doesn't fire... Quote Link to comment Share on other sites More sharing options...
EchoFool Posted August 24, 2009 Share Posted August 24, 2009 Does the page source show the overlay div echo'd ? if not then the if statement is failing... Quote Link to comment Share on other sites More sharing options...
cowboysdude Posted August 24, 2009 Author Share Posted August 24, 2009 Does the page source show the overlay div echo'd ? if not then the if statement is failing... I would say not.. this is all it's showing... <!-- overlays for videos --> </div> </div> </div> </div> </div> </div> Quote Link to comment Share on other sites More sharing options...
oni-kun Posted August 24, 2009 Share Posted August 24, 2009 Try this then: <?php If ($v1=="1") { echo '<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/'. $vid1 . '"> </a> </div>'; } else { die('$v1 is NOT set'); } ?> That'll stop the script if $v1 isn't set.. therefor not letting your IF statement echo anything, for testing purposes. If it's not echo'ing, then obviously your =1 isn't working.. Quote Link to comment Share on other sites More sharing options...
cowboysdude Posted August 24, 2009 Author Share Posted August 24, 2009 Ok I got $v1 - 10 set.. NOW what is wrong with the following statement because I am just not seeing it... <?php If ($v1=="1") { echo '<p><button rel="#overlay1">'. $title1.'</button></p>' } ?> But this is NOW what's stopping the page from loading.. hummmmm Quote Link to comment Share on other sites More sharing options...
cowboysdude Posted August 25, 2009 Author Share Posted August 25, 2009 Ok got it!! Here it is.. <?php If ($v1=="1") { echo '<button rel="#overlay2">'. $title1.'</button>'; } ?> Many Thanks for all your help!! I'm marking this one solved!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.