changing the link stucture

I have a code that creates a keyword cloud. I am wanting to change where it opens the information after it queries Google. I have a table that holds the body info and want to display it in there. seem possible from the code below? currently is opening on a new page. the first code is the cloud gen. and the second code is where you place the cloud.
I really want to send the variables through the Google search function on the site. it is a paid search for the site so there are no ads. it is .js and not sure how i would do that. if you want i can post the code for the search but it is the same as everyone's, just let me know. any suggestions?
thank you
<?php

$text_content = ("$pageId, $title");


/* array sort helper function */
function randomSort($a, $b)
{
    return rand(-1, 1);
}
	
class PTagCloud
{
	var $m_arTags = array();
	
	//custom parameters
	var $m_displayedElementsCount;
	var $m_searchURL; 
	var $m_backgroundImage;
	var $m_backgroundColor;
	var $m_width;
	var $m_arColors;
	var $m_bUTF8;
	
	function __construct($displayedElementCount, $arSeedWords = false)
	{
	    $this->m_displayedElementsCount = $displayedElementCount;
	    $this->m_searchURL = "http://www.google.com/search?hl=en&sitesearch=www.MYDOMAIN.com&q=";
	    $this->m_bUTF8 = false;
	    $this->m_backgroundColor = "#ffffff";
	    $this->m_arColors[0] = "#5122CC";
	    $this->m_arColors[1] = "#229926";
	    $this->m_arColors[2] = "#330099";
	    $this->m_arColors[3] = "#819922";
	    $this->m_arColors[4] = "#22CCC3";
	    $this->m_arColors[5] = "#99008D";
	    $this->m_arColors[6] = "#943131";
	    $this->m_arColors[7] = "#B23B3B";
	    $this->m_arColors[8] = "#229938";
	    $this->m_arColors[9] = "#419922";
	    
		if ($arSeedWords !== false && is_array($arSeedWords))
		{
			foreach ($arSeedWords as $key => $value)
			{
				$this->addTag($value);
			}
		}
	}
	 
	function PTagCloud($displayedElementCount, $arSeedWords = false)
	{
		$this->__construct($displayedElementCount, $arSeedWords);
	}
	
	function setSearchURL($searchURL)
	{
	    $this->m_searchURL = $searchURL;
	}

	function setUTF8($bUTF8)
	{
	    $this->m_bUTF8 = $bUTF8;
	}

	function setWidth($width)
	{
	    $this->m_width = $width;
	}

	function setBackgroundImage($backgroundImage)
	{
	    $this->m_backgroundImage = $backgroundImage;
	}

	function setBackgroundColor($backgroundColor)
	{
	    $this->m_backgroundColor = $backgroundColor;
	}
	
	function setTextColors($arColors)
	{
	    $this->m_arColors = $arColors;
	}
	 
	/* word replace helper */
    function str_replace_word($needle, $replacement, $haystack)
    {
        $pattern = "/\b$needle\b/i";
        $haystack = preg_replace($pattern, $replacement, $haystack);
        return $haystack;
    }

    function keywords_extract($text)
    {
        $text = strtolower($text);
        $text = strip_tags($text);
      
        /* 
         * Handle common words first because they have punctuation and we need to remove them
         * before removing punctuation.
         */
        $commonWords = "'tis,'twas,a,able,about,across,after,ain't,all,almost,also,am,among,an,and,any,are,aren't," .
            "as,at,be,because,been,but,by,can,can't,cannot,could,could've,couldn't,dear,did,didn't,do,does,doesn't," .
            "don't,either,else,ever,every,for,from,get,got,had,has,hasn't,have,he,he'd,he'll,he's,her,hers,him,his," .
            "how,how'd,how'll,how's,however,i,i'd,i'll,i'm,i've,if,in,into,is,isn't,it,it's,its,just,least,let,like," .
            "likely,may,me,might,might've,mightn't,most,must,must've,mustn't,my,neither,no,nor,not,o'clock,of,off," .
            "often,on,only,or,other,our,own,rather,said,say,says,shan't,she,she'd,she'll,she's,should,should've," .
            "shouldn't,since,so,some,than,that,that'll,that's,the,their,them,then,there,there's,these,they,they'd," .
            "they'll,they're,they've,this,tis,to,too,twas,us,wants,was,wasn't,we,we'd,we'll,we're,were,weren't,what," .
            "what'd,what's,when,when,when'd,when'll,when's,where,where'd,where'll,where's,which,while,who,who'd," .
            "who'll,who's,whom,why,why'd,why'll,why's,will,with,won't,would,would've,wouldn't,yet,you,you'd,you'll," .
            "you're,you've,your,gif,alt,php,spacer,fill,out";
        $commonWords = strtolower($commonWords);
        $commonWords = explode(",", $commonWords);
        foreach($commonWords as $commonWord)
        {
            $text = $this->str_replace_word($commonWord, "", $text);  
        }

        /* remove punctuation and newlines */
        /*
         * Changed to handle international characters
         */
        if ($this->m_bUTF8)
            $text = preg_replace('/[^\p{L}0-9\s]|\n|\r/u',' ',$text);
        else
            $text = preg_replace('/[^a-zA-Z0-9\s]|\n|\r/',' ',$text);
            
        /* remove extra spaces created */
        $text = preg_replace('/ +/',' ',$text);
      
        $text = trim($text);
        $words = explode(" ", $text);
        foreach ($words as $value) 
        {
            $temp = trim($value);
            if (is_numeric($temp))
                continue;
            $keywords[] = trim($temp);
        }
    
        return $keywords;
    }
  
    function addTagsFromText($SeedText)
    {
        $words = $this->keywords_extract($SeedText);
		foreach ($words as $key => $value)
		{
			$this->addTag($value);
		}
    }
	
	function addTag($tag, $useCount = 1)
	{
		$tag = strtolower($tag);
		if (array_key_exists($tag, $this->m_arTags))
			$this->m_arTags[$tag] += $useCount;
		else
			$this->m_arTags[$tag] = $useCount;
	}
	 
	function gradeFrequency($frequency)
	{
	    $grade = 0;
		if ($frequency >= 45)
			$grade = 9;
		else if ($frequency >= 40)
			$grade = 8;
		else if ($frequency >= 35)
			$grade = 7;
		else if ($frequency >= 30)
			$grade = 6;
		else if ($frequency >= 25)
			$grade = 5;
		else if ($frequency >= 20)
			$grade = 4;
		else if ($frequency >= 15)
			$grade = 3;
		else if ($frequency >= 10)
			$grade = 2;
		else if ($frequency >= 5)
			$grade = 1;
		 
		return $grade;
	}
	 
	function emitCloud($bHTML = true)
	{
	    arsort($this->m_arTags);
	    $arTopTags = array_slice($this->m_arTags, 0, $this->m_displayedElementsCount);
	    
	    /* randomize the order of elements */
		uasort($arTopTags, 'randomSort');
		
		$this->maxCount = max($this->m_arTags);
		if (is_array($this->m_arTags))
		{
			if ($bHTML) 
			    $result = '<div id="id_tag_cloud" style="' . (isset($this->m_width) ? ("width:". $this->m_width. ";") : "") .
			               'line-height:normal"><div style="border-style:solid;border-width:1px;' .
			              (isset($this->m_backgroundImage) ? ("background:url('". $this->m_backgroundImage ."');") : "") .
			              'border-color:#888;margin-top:20px;margin-bottom:10px;padding:5px 5px 20px 5px;background-color:'.$this->m_backgroundColor.';">';
            else			    
                $result = array();
			foreach ($arTopTags as $tag => $useCount)
			{
				$grade = $this->gradeFrequency(($useCount * 100) / $this->maxCount);
				if ($bHTML)
				{
					$result .= ("<a href=\"". $this->m_searchURL.urlencode($tag)."\" title=\"More info on " .   /*this is where the size of the text is*/
					    $tag."\" style=\"color:".$this->m_arColors[$grade].";\">" .
					    "<span style=\"color:".$this->m_arColors[$grade]."; letter-spacing:3px; ".
					    "padding:4px; font-family:Tahoma; font-weight:900; font-size:" . 
					    (0.6 + 0.1 * 2 * $grade) . "em\">".$tag."</span></a> ");
				}
				else
				    $result[$tag] = $grade;
			}
			if ($bHTML)
            $result .= ('</div><div style="position:relative;top:-25px">' .
                           '<div style="float:right;padding-right:5px;height:15px;font-size:10px">' .
                       //    '<a style="color:#777" target="_blank" href="http://\www..com"></a>' .    //////<<---- this is does nothing
                           '</div></div></div><br />');

			return $result;
		}
	}
}

?>

Open in new window

LVL 2
jaxbrianAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Michel PlungjanIT ExpertCommented:
You mean you want to change this  to open the anchor content in a table?

$result .= ("<a href=\"". $this->m_searchURL.urlencode($tag)."\" title=\"More info on " .   /*this is where the size of the text is*/
                                  $tag."\" style=\"color:".$this->m_arColors[$grade].";\">" .
                                  "<span style=\"color:".$this->m_arColors[$grade]."; letter-spacing:3px; ".
                                  "padding:4px; font-family:Tahoma; font-weight:900; font-size:" .
                                  (0.6 + 0.1 * 2 * $grade) . "em\">".$tag."</span></a>

try

$result .= ("<a TARGET=\"iframe1\" href=\"".  $this->m_searchURL.urlencode($tag)."\" title=\"More info on " .    /*this is where the size of the text is*/
                                  $tag."\"  style=\"color:".$this->m_arColors[$grade].";\">" .
                                   "<span style=\"color:".$this->m_arColors[$grade].";  letter-spacing:3px; ".
                                  "padding:4px; font-family:Tahoma;  font-weight:900; font-size:" .
                                  (0.6 + 0.1 * 2 * $grade) .  "em\">".$tag."</span></a>

and have
<iframe name="iframe1" style="width:100%; height:100%"></iframe>

in your table

Otherwise you will need to ajax a proxied page
0
jaxbrianAuthor Commented:
thank you, I will try in just a minute.
0
Michel PlungjanIT ExpertCommented:
PS: Why the span in a link?
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

jaxbrianAuthor Commented:
I have no idea why there is a span tag in there. I got the scritp off line and only modified what I needed to. the rest I just left alone. is there a way to get rid of the border on the iframe? the info is being pulled into the iframe when i click on the link. thank you for that. what do you think about the compatibility of the iframes?
thank you
0
Michel PlungjanIT ExpertCommented:
frameBorder="0"

iframe is compatible and you do not have to do any cross domain stuff if you use it
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jaxbrianAuthor Commented:
thank you very much for your help with this. I am still waiting on google to message me back about a direct link through the search function they have with no ads.


thank you
B
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.