SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Location
    Cambridge, UK
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Echo a flash object help

    I am on the learning curve and have come across a problem I hope someone can help me with. I have tried searching the net and have various things tried but don't work, so I have 2 flash buttons repesenting Member and Log In, when on the Log in screen I want the Log In flash button to be seen, so with text I had:-

    <?php
    }
    else
    {
    echo "LOGIN";
    }
    }
    ?>


    I then tried to change the Log In for my embedded flash button and got a parse error.
    Can anyone please help me with this?

    Thanks,

  2. #2
    Maniacally depressed robot poncho's Avatar
    Join Date
    Dec 2004
    Location
    Belfast, N.Ireland
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Just escape out of PHP.

    Eg.
    Code:
    <?php if($logged_in) { ?>
    
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="60" height="20">
      <param name="movie" value="login.swf" />
      <param name="quality" value="high" />
      <embed src="login.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="60" height="20"></embed>
    </object>
    <?php } ?>
    Perfecting the art of breaking stuff.
    Check 'em: CakePHP | TextMate

  3. #3
    SitePoint Member
    Join Date
    Feb 2005
    Location
    Cambridge, UK
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Poncho,

    Thanks for the help although as I said I am a real novice here and have a script I paid for which I am trying to change the cosmetics of.

    So here is the code I have and what I want to do is replace the echo LOG IN and echo MEMBERS for the relative flash button and I can't get it to work, usually parse errors.
    <?php
    if(isset($_SESSION["dtg_userid"]))
    {
    if(!preg_match("/\/userhome.php/",$_SERVER['SCRIPT_NAME']))
    {
    ?>
    <div align="center"><a href="userhome.php" class="toplinkbar style10">
    <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="22">
    <param name="movie" value="button6.swf">
    <param name="quality" value="high">
    <param name="bgcolor" value="#F2F7FF">
    <embed src="button6.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="22" bgcolor="#F2F7FF"></embed>
    </object>
    </a>
    <?php
    }
    else
    {
    echo "MEMBERS";
    }
    }
    else
    {
    if(!preg_match("/\/signin.php/",$_SERVER['SCRIPT_NAME']))
    {
    ?>
    <a href="signin.php" class="toplinkbar style10">
    <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="22">
    <param name="movie" value="button7.swf">
    <param name="quality" value="high">
    <param name="bgcolor" value="#F2F7FF">
    <embed src="button7.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="22" bgcolor="#F2F7FF"></embed>
    </object>
    </a>
    <?php
    }
    else
    {
    echo "LOGIN";
    }
    }
    ?>


    I hope you can help as I am getting worried I can't do it!!

    Thanks,

  4. #4
    Maniacally depressed robot poncho's Avatar
    Join Date
    Dec 2004
    Location
    Belfast, N.Ireland
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey Greeham,

    Try this...

    PHP Code:
    <?php
    // If the session exists do this
    if(isset($_SESSION["dtg_userid"])) {

        
    // If the current file is "userhome.php"
        // then show "button6.swf"
        
    if(!preg_match("/\/userhome.php/",$_SERVER['SCRIPT_NAME'])) {
    ?>
    <div align="center"><a href="userhome.php" class="toplinkbar style10">
    <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="22">
    <param name="movie" value="button6.swf">
    <param name="quality" value="high">
    <param name="bgcolor" value="#F2F7FF">
    <embed src="button6.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="22" bgcolor="#F2F7FF"></embed>
    </object>
    </a>
    <?php
    }

        
    // Or, if the current file is "signin.php"
        // then show "button7.swf"
        
    elseif(!preg_match("/\/signin.php/",$_SERVER['SCRIPT_NAME'])) {
    ?>
    <a href="signin.php" class="toplinkbar style10">
    <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="22">
    <param name="movie" value="button7.swf">
    <param name="quality" value="high">
    <param name="bgcolor" value="#F2F7FF">
    <embed src="button7.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="22" bgcolor="#F2F7FF"></embed>
    </object>
    </a>
    <?php
        
    }
    }
    ?>
    If I understand correctly, you are including this file into both "signin.php" and "userhome.php", and want the script to show "button6.swf" if the user is logged in and is on "userhome.php" or if the user is no logged in and is on "signin.php" to show "button7.swf"?

    Hopefully this should do the trick.
    Perfecting the art of breaking stuff.
    Check 'em: CakePHP | TextMate

  5. #5
    SitePoint Member
    Join Date
    Feb 2005
    Location
    Cambridge, UK
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Again,

    Ok, seem to be getting somwhere now, thanks again for your help so far.

    Now I am not getting parse errors with the code you suggested but there are no buttons showing at all now.

    I might just bite the bullet and have the buttons seperately in the table and have either show up as and when the user is logged in, if possible!

    Any further advice would greatly be appreciated and thanks again for your help so far,

    Thanks,

  6. #6
    Maniacally depressed robot poncho's Avatar
    Join Date
    Dec 2004
    Location
    Belfast, N.Ireland
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Greeham,

    Are you including this file in both "signin.php" and "userhome.php"? If that is the case, can you attatch both files so that I can have a better look at what's going on?
    Perfecting the art of breaking stuff.
    Check 'em: CakePHP | TextMate

  7. #7
    SitePoint Member
    Join Date
    Feb 2005
    Location
    Cambridge, UK
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Poncho,

    Thanks a lot for all your help, I will try and explain a bit better. The file with the code is my template.php file. I have a row of links across the top and one is the one I showed the code for. So there are, 2 buttons in the template.php (Log In and Members).

    As I mentioned when I visit my home page (index.php) the template is included and showing is the Log In button. If I click it, it takes me to the signin.php file (which also includes the template.php) and the Log In Button turns into LOG IN in text (as I described originally).

    Once you log in, it then turns to the Member button and when I press the Member button to go to the userhome.php file (also including the template.php), I get Members in text (also described before).
    Now the could you gave me I put into the template.php file. I presume I went wrong here? If I place the code into the signin.php and userhome.php, would that not have any effect on my template.php file?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •