Celebslam Posted November 9, 2006 Share Posted November 9, 2006 Example Picture: http://www.celebslam.com/hillary-duff-had-it-coming/hilary-duff-stalked-by-russian-maksim-miakovsky/From this post: http://www.celebslam.com/hillary-duff-had-it-coming/As you can tell, there's no way to tell the picture came from an original story (unless you look at the URL but not everyone is that savvy). How do I provide a link back to the original story from the image page (I'm using an attachment.php on wordpress)? Link to comment https://forums.phpfreaks.com/topic/26660-how-do-i-link-back-to-the-main-story-from-a-custom-picture-attachment/ Share on other sites More sharing options...
Monkeymatt Posted November 9, 2006 Share Posted November 9, 2006 You could take the url using $_SERVER['PHP_SELF'] or $_SERVER['REQUEST_URI'] and split off the last folder-type section: (untested code)[code]<?php$link=preg_replace("#(http://(www.)?([^\.]*)\.[a-z]{2,4}/([^/]*)/)(.*)/#Ui", "\\1", $_SERVER['REQUEST_URI']);?>[/code]Monkeymatt Link to comment https://forums.phpfreaks.com/topic/26660-how-do-i-link-back-to-the-main-story-from-a-custom-picture-attachment/#findComment-121964 Share on other sites More sharing options...
Celebslam Posted November 11, 2006 Author Share Posted November 11, 2006 didn't seem to work Link to comment https://forums.phpfreaks.com/topic/26660-how-do-i-link-back-to-the-main-story-from-a-custom-picture-attachment/#findComment-122953 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.