Hey everybody I am have a bit of trouble with my links

The standard link would look like this:

<a Title = "New Link" href/=.....

When I move the mouse of the link I get a text that says "New Link"

But now if I go:

$Message = "New Link";

echo "<a Title = $Message href/=......

when the mouse moves over it I only get "New"

My question is why do I only get the first word when using a php variable? And also is it possible to do a multie line link title?

    you need to use quotes

    echo "<a Title = '$Message' href/=......

    no you cant do multiline titles in html, but you could use javascript to achieve it

    google for 'javascript tooltip'

      Although it isn't incorrect, be careful single quoting your title attribute. If your $Message variable is something like "Your title's right here", then the quote on the word title's could end up closing your attribute and chop it off so you only get "Your title". The standard defacto is to double-quote. Whichever way you do it, just be consistent.

      echo "<a Title = '$Message' href/=......

      An alternative (which conforms a little more to the W3C standards for HTML/XML/XHTML coding) would be to double quote it (of course, being sure to escape the string on the PHP side of things.)

      echo "<a Title = \"". $Message . "\" href=\"link.php\">";
      

        Or to use single quotes in php

        
        echo '<a Title = " '. $Message . ' " href="link.php">';
        
        

        Looks a lot cleaner and easier to read, also less likely to make syntax errors as you cannot embed vars in the string but have to concatenate them. Which is why I'm an advocate of the single quote as standard coding practice.

          Ok I searched and found tooltip java function that claims to be compatiable with lots of browers!

          www.walterzorn.com/tooltip/tooltip_e.htm

          Now I followed his instructions:

          The file is the same directory!
          I added this to top of my Php file
          echo " <script language='JavaScript' type='text/javascript' src='wz_tooltip.js'></script> ";

          And My link looks like this

          $previous_link = "<a onmouseover=return escape('fun') href=\"modules.php?name=$module_name&date=........

          The page loads with no erros but the tool tip doesn't show up! Anybody have a clue what this can be?

            Well, you have to actually add the html to your output. Post the link to your page and we''ll see what is going on. My guesse is that you are not echoing out the $previous_link .

            And I'll bet you have not yet understood that PHP is a SERVER SCRIPTING language that NEVER runs on the client. ALL OUTPUT TO HTML MUST BE ECHOed OR PRINTed INTO THE HTML OUTPUT STREAM.

              Incedentally, nice link to a nice script. The man knows his stuff.

                Ya it would be cool if I get it to work Ok I simplyfide my code and yes I know that I need to echo the html code :glare:

                ok the script def at the top of my page under the <?PHP
                echo "<script language='JavaScript' type='text/javascript' src='modules/$module_name/wz_tooltip.js'></script> ";

                where I want to display the link
                echo "<a onmouseover=return escape('fun') href='www.yahoo.com'>The test link</a>";

                Tooltip function is in the dir!

                The link shows up but the tool tip does not?

                Anybody Have any Ideas?

                  Sorry for shouting at you, my bad manners and I apolgies.

                  Now, your js function includes the embedded $module_name . Have you assigned a value to this var before you echo it out?

                  (and again appolgies if I'm insulting you by asking the obvious)

                    I am using PHP nuke and so this variable is a global and it is assigned to the correct module name? 🙁 This reallz getting fustrating

                      PHP Nuke - I know nothing about it, sorry can't help you.

                      Except, 'GLOBAL' ? Depends on the version you are using and the server settings. Check your phpinfo() to see if register globals is set ON or OFF. And if that is meaningless in PHP Nuke then, as I said, "I know nothing"

                        I check everything is ok if I Echo the varibale the corret value is dsiplayed

                          I take you back to mine and Roger's original posts...

                          Concatenate your variable:
                          Instead of:

                          echo "<script language='JavaScript' type='text/javascript' src='modules/$module_name/wz_tooltip.js'></script> "; 
                          

                          try this instead:

                          echo '<script language="JavaScript" type="text/javascript" src="modules/' . $module_name . '/wz_tooltip.js"></script>'; 
                          
                            Write a Reply...