GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   PHP gurus I need your help please ... (https://gfy.com/showthread.php?t=890914)

halfpint 03-01-2009 03:08 PM

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;

Killswitch - BANNED FOR LIFE 03-01-2009 03:09 PM

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

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

Trev_UK 03-01-2009 03:10 PM

you need to define $vars

halfpint 03-01-2009 03:14 PM

Quote:

Originally Posted by Killswitch (Post 15567294)
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

Serge Litehead 03-01-2009 03:14 PM

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;

halfpint 03-01-2009 03:15 PM

Quote:

Originally Posted by Trev_UK (Post 15567297)
you need to define $vars

how do I do that :helpme

Serge Litehead 03-01-2009 03:16 PM

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.

Trev_UK 03-01-2009 03:18 PM

Quote:

Originally Posted by halfpint (Post 15567320)
how do I do that :helpme


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

nation-x 03-01-2009 03:18 PM

buttsecks is good for your balls

halfpint 03-01-2009 03:19 PM

Quote:

Originally Posted by Trev_UK (Post 15567337)
<?php $vars = 'http://www.somedomain.com'; ?>

thank you :thumbsup

Trev_UK 03-01-2009 03:20 PM

Quote:

Originally Posted by holograph (Post 15567327)
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

Serge Litehead 03-01-2009 03:26 PM

Quote:

Originally Posted by Trev_UK (Post 15567349)
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

Libertine 03-01-2009 03:28 PM

Am I missing something or are you all insanely stupid? :eek7

Serge Litehead 03-01-2009 03:31 PM

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>

Trev_UK 03-01-2009 03:31 PM

Quote:

Originally Posted by holograph (Post 15567371)
it can be done the same way as .html being inturpreted by php engine

.htaccess

Trev_UK 03-01-2009 03:38 PM

Quote:

Originally Posted by Libertine (Post 15567375)
Am I missing something or are you all insanely stupid? :eek7

Feel free to give an answer...

Killswitch - BANNED FOR LIFE 03-01-2009 03:39 PM

Quote:

Originally Posted by Trev_UK (Post 15567337)
<?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.

Trev_UK 03-01-2009 03:42 PM

Quote:

Originally Posted by Killswitch (Post 15567427)
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

Killswitch - BANNED FOR LIFE 03-01-2009 03:44 PM

Quote:

Originally Posted by Trev_UK (Post 15567441)
a simple echo $vars would work a treat

test it...

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

I get this returned, 'h'

Killswitch - BANNED FOR LIFE 03-01-2009 03:45 PM

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

That works though ;)

Trev_UK 03-01-2009 03:47 PM

Quote:

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

That works though ;)

me likes, you da hero lol ;)

Libertine 03-01-2009 03:51 PM

Quote:

Originally Posted by Trev_UK (Post 15567422)
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.

Killswitch - BANNED FOR LIFE 03-01-2009 03:54 PM

Quote:

Originally Posted by Trev_UK (Post 15567467)
me likes, you da hero lol ;)

:thumbsup:thumbsup


All times are GMT -7. The time now is 05:08 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123