Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 06-26-2009, 12:14 AM   #1
sheepish
Confirmed User
 
Join Date: Jun 2002
Posts: 48
PHP guys - help, please

Good morning board. As if I wasn't bald enough already, I'm trying to modify my blogs and coming across a problem...

At the moment I have a lot of posts with thumbnail images that, when clicked, just are linked to themselves i.e. bringing up that image in a new window. What I'm after is a way of modifing wordpress so that when the image is clicked, the clicker gets sent to a specific URL.

I have found the regex that selects the <a href... through to the /a> and can change it but I need a way to keep the <img src...> the same.

Allegedly the code below in your template can be used to remove the img src - can it be modified to change the a href but keep the img src?

PHP Code:
<?php   
$content 
get_the_content();   
$postOutput preg_replace('/<img[^>]+./',''$content);   
echo 
$postOutput;   
?>
Any thoughts?

Cheers

M.
sheepish is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 12:34 AM   #2
fallenmuffin
Confirmed User
 
fallenmuffin's Avatar
 
Industry Role:
Join Date: Nov 2005
Posts: 8,170
You can play with '<a href="([^"]+)">([^<]+)<\/a>' and see what you can do with it. Too tired/lazy to code it up.
fallenmuffin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 12:42 AM   #3
2012
So Fucking What
 
2012's Avatar
 
Industry Role:
Join Date: Jul 2006
Posts: 17,189
so you want us to help you remove all the "link codes" in your images ... neat
__________________
best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself
2012 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 12:54 AM   #4
2012
So Fucking What
 
2012's Avatar
 
Industry Role:
Join Date: Jul 2006
Posts: 17,189
__________________
best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself
2012 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 01:11 AM   #5
sheepish
Confirmed User
 
Join Date: Jun 2002
Posts: 48
Quote:
Originally Posted by fartfly View Post
so you want us to help you remove all the "link codes" in your images ... neat
Not all, no but you're on the correct lines.
sheepish is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 02:22 AM   #6
quantum-x
Confirmed User
 
quantum-x's Avatar
 
Join Date: Feb 2002
Location: ICQ: 251425 Fr/Au/Ca
Posts: 6,863
Quote:
Originally Posted by fallenmuffin View Post
You can play with '<a href="([^"]+)">([^<]+)<\/a>' and see what you can do with it. Too tired/lazy to code it up.
That's a terrible regex
quantum-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 02:33 AM   #7
2012
So Fucking What
 
2012's Avatar
 
Industry Role:
Join Date: Jul 2006
Posts: 17,189
Quote:
Originally Posted by quantum-x View Post
That's a terrible regex
__________________
best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself
2012 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 02:35 AM   #8
fallenmuffin
Confirmed User
 
fallenmuffin's Avatar
 
Industry Role:
Join Date: Nov 2005
Posts: 8,170
Quote:
Originally Posted by quantum-x View Post
That's a terrible regex
So, offer him a better one. It's one I grabbed off StackFlow.
fallenmuffin is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 02:35 AM   #9
2012
So Fucking What
 
2012's Avatar
 
Industry Role:
Join Date: Jul 2006
Posts: 17,189
Quote:
Originally Posted by fallenmuffin View Post
So, offer him a better one. It's one I grabbed off StackFlow.
werd let's help each other fuckin shit fuck ...
__________________
best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself

Last edited by 2012; 06-26-2009 at 02:38 AM..
2012 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 02:55 AM   #10
2012
So Fucking What
 
2012's Avatar
 
Industry Role:
Join Date: Jul 2006
Posts: 17,189
I mean, It's such a forgiving environment ... why wouldn't you pull some bullshit code and pisson'em like that.

It's a great place for friends and shit. Cool, yeah
__________________
best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself
2012 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 03:51 AM   #11
2012
So Fucking What
 
2012's Avatar
 
Industry Role:
Join Date: Jul 2006
Posts: 17,189
Quote:
Originally Posted by quantum-x View Post
That's a terrible regex
__________________
best host: Webair | best sponsor: Kink | best coder: 688218966 | Go Fuck Yourself
2012 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 06:08 AM   #12
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
Code:
^<a[^>]*(http://[^"]*)[^>]*>([ 0-9a-zA-Z]+)</a>$
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 06:55 AM   #13
quantum-x
Confirmed User
 
quantum-x's Avatar
 
Join Date: Feb 2002
Location: ICQ: 251425 Fr/Au/Ca
Posts: 6,863
I was passing through at 4:30AM - just felt obligated to point out that the regex posted was very weak.

Now, the regex posted by fris is a hell of a lot better - it actually copes with real world scenarios.

I'm sorry if you don't like me pointing out what strikes me as non-optimised code. Rubbing each other's nuts helps noone ;)
quantum-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 06:58 AM   #14
tranza
ICQ: 197-556-237
 
Join Date: Jun 2003
Location: BRASIL !!!
Posts: 57,559
Bump for php coders
__________________
I'm just a newbie.
tranza is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 07:57 AM   #15
Iron Fist
Too lazy to set a custom title
 
Join Date: Dec 2006
Posts: 23,400
Quote:
Originally Posted by quantum-x View Post
Rubbing each other's nuts helps noone ;)
It does feel really good however.
__________________
i like waffles
Iron Fist is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 08:14 AM   #16
quantum-x
Confirmed User
 
quantum-x's Avatar
 
Join Date: Feb 2002
Location: ICQ: 251425 Fr/Au/Ca
Posts: 6,863
Quote:
Originally Posted by sharphead View Post
It does feel really good however.
Little lower please
quantum-x is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 08:17 AM   #17
ExLust
Confirmed User
 
ExLust's Avatar
 
Join Date: Aug 2008
Posts: 3,223
Mmmm... interesting!
__________________

BE A PARTNER
ExLust is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 08:17 AM   #18
gornyhuy
Chafed.
 
gornyhuy's Avatar
 
Join Date: May 2002
Location: Face Down in Pussy
Posts: 18,041
regex gives me heartburn and I only fuck with it while on the clock.
__________________

icq:159548293
gornyhuy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 10:39 AM   #19
sheepish
Confirmed User
 
Join Date: Jun 2002
Posts: 48
Thanks Fris - it worked a treat and is much appreciated. And thanks for all for helping out (even FartFly!)

M.
sheepish is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 06-26-2009, 11:09 AM   #20
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,359
Quote:
Originally Posted by sheepish View Post
Thanks Fris - it worked a treat and is much appreciated. And thanks for all for helping out (even FartFly!)

M.
No problem
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.