PHP gurus I need your help please ...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • halfpint
    GFY's Halfpint
    • Jun 2007
    • 15223

    #1

    PHP gurus I need your help please ...

    Im trying to link this code and image to a url so that when a surfer clicks on the image it takes the surfer back to the homepage.. and I am stuck.. Anybody know how to do this..

    Any help appreciated thanks

    Code:
    background:white url(<?php echo $vars['url']; ?>mod/brighton_boat/graphics/cz4.jpg)no-repeat left top;

    Get FREE website listings on Cryptocoinshops.net
  • Killswitch - BANNED FOR LIFE

    #2
    What's $vars['url'] set as?

    Edit: I'm confused at what you're doing, that's CSS with a PHP echo.

    Comment

    • Trev_UK
      Registered User
      • Aug 2003
      • 83

      #3
      you need to define $vars

      Comment

      • halfpint
        GFY's Halfpint
        • Jun 2007
        • 15223

        #4
        Originally posted by Killswitch
        What's $vars['url'] set as?

        Edit: I'm confused at what you're doing, that's CSS with a PHP echo.
        yes it is css, is there a way I can do this using the css file ? link the image to an url

        Get FREE website listings on Cryptocoinshops.net

        Comment

        • Serge Litehead
          Confirmed User
          • Dec 2002
          • 5190

          #5
          so whats is the problem?

          by looking at your code all seems normal, maybe a slash is missing between closing php tag and "mod/bri..." ?
          background:white url(<?php echo $vars['url']; ?>/mod/brighton_boat/graphics/cz4.jpg)no-repeat left top;

          Comment

          • halfpint
            GFY's Halfpint
            • Jun 2007
            • 15223

            #6
            Originally posted by Trev_UK
            you need to define $vars
            how do I do that

            Get FREE website listings on Cryptocoinshops.net

            Comment

            • Serge Litehead
              Confirmed User
              • Dec 2002
              • 5190

              #7
              php must be able to interpret php code in css first though if that code is applied in css file.. if its in php..

              look at the source and see what $vars['url']; output there or print it somewhere else.
              Last edited by Serge Litehead; 03-01-2009, 01:19 PM.

              Comment

              • Trev_UK
                Registered User
                • Aug 2003
                • 83

                #8
                Originally posted by halfpint
                how do I do that

                <?php $vars = 'http://www.somedomain.com'; ?>

                Comment

                • nation-x
                  Confirmed User
                  • Mar 2004
                  • 5370

                  #9
                  buttsecks is good for your balls

                  Comment

                  • halfpint
                    GFY's Halfpint
                    • Jun 2007
                    • 15223

                    #10
                    Originally posted by Trev_UK
                    <?php $vars = 'http://www.somedomain.com'; ?>
                    thank you

                    Get FREE website listings on Cryptocoinshops.net

                    Comment

                    • Trev_UK
                      Registered User
                      • Aug 2003
                      • 83

                      #11
                      Originally posted by holograph
                      php must be able to interpret php code in css first though
                      indeed, not sure if writing the css as a php file and using a mod rewrite would work, in my head it would lol

                      Comment

                      • Serge Litehead
                        Confirmed User
                        • Dec 2002
                        • 5190

                        #12
                        Originally posted by Trev_UK
                        indeed, not sure if writing the css as a php file and using a mod rewrite would work, in my head it would lol
                        it can be done the same way as .html being inturpreted by php engine

                        Comment

                        • Libertine
                          sex dwarf
                          • May 2002
                          • 17860

                          #13
                          Am I missing something or are you all insanely stupid?
                          /(bb|[^b]{2})/

                          Comment

                          • Serge Litehead
                            Confirmed User
                            • Dec 2002
                            • 5190

                            #14
                            to link the image directly to url it can be done this way:

                            in styles:
                            #link1 { background:white url(mod/brighton_boat/graphics/cz4.jpg)no-repeat left top; } /* just make sure to set width and height of an actual image */

                            in html source
                            <a id="link1" href="http://URL"></a>

                            Comment

                            • Trev_UK
                              Registered User
                              • Aug 2003
                              • 83

                              #15
                              Originally posted by holograph
                              it can be done the same way as .html being inturpreted by php engine
                              .htaccess

                              Comment

                              • Trev_UK
                                Registered User
                                • Aug 2003
                                • 83

                                #16
                                Originally posted by Libertine
                                Am I missing something or are you all insanely stupid?
                                Feel free to give an answer...

                                Comment

                                • Killswitch - BANNED FOR LIFE

                                  #17
                                  Originally posted by Trev_UK
                                  <?php $vars = 'http://www.somedomain.com'; ?>
                                  Would throw an error as $vars is an array according to his current code, unless he removes the array bit from it so it's just a regular variable.

                                  Comment

                                  • Trev_UK
                                    Registered User
                                    • Aug 2003
                                    • 83

                                    #18
                                    Originally posted by Killswitch
                                    Would throw an error as $vars is an array according to his current code, unless he removes the array bit from it so it's just a regular variable.
                                    a simple echo $vars would work a treat

                                    Comment

                                    • Killswitch - BANNED FOR LIFE

                                      #19
                                      Originally posted by Trev_UK
                                      a simple echo $vars would work a treat
                                      test it...

                                      <?php
                                      $vars = 'http://www.somedomain.com';
                                      echo $vars['url'];
                                      ?>

                                      I get this returned, 'h'

                                      Comment

                                      • Killswitch - BANNED FOR LIFE

                                        #20
                                        <?php
                                        $vars = array('url' => 'http://www.somedomain.com');
                                        echo $vars['url'];
                                        ?>

                                        That works though ;)

                                        Comment

                                        • Trev_UK
                                          Registered User
                                          • Aug 2003
                                          • 83

                                          #21
                                          Originally posted by Killswitch
                                          <?php
                                          $vars = array('url' => 'http://www.somedomain.com');
                                          echo $vars['url'];
                                          ?>

                                          That works though ;)
                                          me likes, you da hero lol ;)

                                          Comment

                                          • Libertine
                                            sex dwarf
                                            • May 2002
                                            • 17860

                                            #22
                                            Originally posted by Trev_UK
                                            Feel free to give an answer...
                                            I'm not entirely sure. I have the flu, and am constantly on the verge of hallucinating due to my fever.

                                            However, even in my current clouded state of mind, most of the posts in this thread seem way off.

                                            First, the .htaccess thing... a far better solution is to rename the .css file to .php, and simply reference that as the style sheet. Works just fine.

                                            Second, the php thing. Why use php if you're going to hardcore the variable, anyway?

                                            Third, the php thing again. His question (as well as his code) had absolutely nothing to do with that piece of php. The url() in the background is the location of the background picture, nothing to do with clickable hyperlinks.

                                            Fourth, the actual question. It makes very little sense. The clickable link is never the background, but the element it's the background of. Since the OP didn't specify what the element is, the entire thread is pointless.

                                            But, again, I'm in a fever-induced state of semi-consciousness, so I may well be talking jibberish which only makes sense to me.
                                            Last edited by Libertine; 03-01-2009, 01:53 PM.
                                            /(bb|[^b]{2})/

                                            Comment

                                            • Killswitch - BANNED FOR LIFE

                                              #23
                                              Originally posted by Trev_UK
                                              me likes, you da hero lol ;)

                                              Comment

                                              Working...