Jump to content

Recommended Posts

Sorry guys to bother you with this simple thing, but my eyes are almost blind to look at php.net, from working on my Website too much, and I really need to get this done.

 

I need to split this string in two parts

 

<BR><BR><A href="http://www.somewebsite">Product</A>

 

We can use the space as a spliting eliment.

 

I know I have been PITA, but could really use your help!

 

Thank you,

Igor

Yes always the same place! Just need to seperate two part, using the first blank space as the seperater.

Sorry forgot to put it in the code tags.

So split between the A h in two parts.

 

<BR><BR><A href="http://www.somewebsite">Product</A>

Thank you. explode should be good, unless they stick another space someplace before A h.

I think I rather explode by A and then stick the A back into the string, this will eliminate a possibility of error.

 

Thank you Ken

Just a spin off of ken's function sorta

 

<?php
$str = '<BR><BR><A href="http://www.somewebsite">Product</A>';
list($part1,$part) = spliti('<A href',$str);
$part = '<A href' . $part;
?>

 

www.php.net/spliti  is a case in-sensitive split function much like explode except, well its case in-sensitive.

 

I just love how there are about 10 different ways to do 1 thing in the programming world =)

This is kinda a weird suggestion, and just ignore it if this surpasses your skill level....

 

If you're trying to pull the url from the link, I suggest exploding " so that $explode_var[1] would be the url and you wouldn't have to mess with stripping quotes or formatting your output to match a certain way....

 

Also, if you wanted to get really fancy with it, you could use regular expressions (this is the part that you can freely ignore ;p).

 

<?php
$url = "<a href=\"http://google.com/\">Google</a>";

//$pattern = "/<a href=(\"|')(http|https):\/\/([a-zA-Z])(?:\"|')>/";

$pattern = "/<a href=\"(.*)\">/";

$pattern = "/<a ([.*]?)href=(?:\"|')(.*)(?:\"|')([.*]?)>(.*)<\/a>/";
//                                            1                               2                  3             4                    5              6
//1 checks for any character between '<a href' (a class= tag or something like that maybe...)  the ? makes this optional
//2  matches either " or ' after href=..... The ?: makes it not store it in the array of parenthesis
//3 matches any character between href=("|') and ("|')  (this would be your url.)
//4 see 2
//5 this matches any content (it's optional) between '" and '>'
//examples could be <a href=""*start matching* *stop matching*> or <a href=""*start matching*/*stop matching*>
//6 matches any thing inbetween > and </a>  (the link text)

if(preg_match($pattern, $url, $matches)) {
//print_r($matches);  //use this to dump matches
echo 'The url is <i>' . $matches[2] . '</i>, and the text for the url is <i>' . $matches[4] . '</i>';
}

?>

Oh I just need to stick rel="nofollow" in the anchor link!

 

This is for my affiliate product links not to leak PR.

 

I got the links from  xml files, which I extracted to a database and now serving based on product correlation. When I extracted the data I was not thinking of doing any manipulation to the anchor link, so extracted it as HTML not uri.

 

But I do not even know if this will help with Google, it got to be very smart now days.

I think it ignores these links anyway because it finds many of them on my Website.

 

Also Google got to be so smart in duplicate content, that even if you have content from x number affiliates concocted on one page, it parses blocks of data and compares them to global recourses for duplicity. If duplicate, it puts the pages in supplementary index.

Now days, there is little original content on the internet, because how many different ways can you call a horse a horse! <__> So what SERP's are looking for is originality in content, like this forum!

 

If you guys needs to get some solid ideas about SEO, come to

http://groups.google.com/group/Google_Webmaster_Help

 

Thank you for your help

 

Okay guys, thank you for all your help.

I am sure there are many ways to do this, but to me simple is best, and as long as it is not error prone I am content.

 

<?php
$rel='rel="nofollow"';
$str = '<BR><BR><A href="http://www.somewebsite">Product</A>';
list($part1,$part2) = explode('href',$str,2);
$anchor=$part1.$rel.' href'.$part2;
echo $anchor;
?>

 

This is an implementation for it.

http://www.travelconnecxion.com/hotels/hotel.php?hotel_id=57881

 

I can use a url rewrite, I will get to doing it when I will get a chance, but I do not think a product description url will put the page back into Google’s main index permenatly.

 

These type of pages go in and out and back in to Google’s main index.

 

I think to permemnatly keep them in the index, I should create a comment section for each page, and populate it with authoritative commentary about the product.

Something like www.tripadvisor.com does! Now to create the plugin in PHP should be relatively easy, but to add relative commentary to 25,000 pages would be Mission Impossible! But I guess this is what community building is about! :)

 

Oh and my eyes are getting better after a little rest!

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.