jquery - Opening a link in a div with PHP -
i building site parses spanish dictionary. if word hola, receive definition, other words, suggestions, casa: http://verbum.xtrweb.com/verbumpost.php?word0=hola&word-1=casa
i wish to: when click on suggestions (like casar in example posted above) print result in div hola. here code using:
$words = array('word0','word-1'); function url_decode($string){ return urldecode(utf8_decode($string)); } $baseurl = 'http://lema.rae.es/drae/srv/search?val='; $cssreplace = <<<eot <style type="text/css"> // changed style </style> </head> eot; $resultindex = 0; foreach($words $word) { if(!isset($_request[$word])) continue; $contents = file_get_contents($baseurl . urldecode(utf8_decode($_request[$word]))); $contents = str_replace('</head>', $cssreplace, $contents); $contents = preg_replace('/(search?[\d\w]+)/','http://lema.rae.es/drae/srv/search', $contents); echo "<div style=' //style ", (++$resultindex) ,"'>", $contents, "</div>"; }
i starting code, please patient, have tried dom code friend suggested failed function.
to output content in styled div, replace:
echo "<div style=' //style ", (++$resultindex) ,"'>", $contents, "</div>"; }
with:
$divstyle = 'background: none repeat scroll 20% center transparent; margin-left: 275px; height: auto; box-shadow: 0px 0px 10px rgb(0, 0, 0) inset; border: 1px solid rgb(0, 0, 0); margin-top: 35px; padding-left: 14px; width: 793px; padding-bottom: 80px;'; //insert $divstyle "style" attribute echo "<div style='" . $divstyle . "'" . (++$resultindex) . "'>" . $contents . "</div>";
2 things changed:
- dots, not commas join stuff in php strings.
- removed overflow(no need scrollbar) , added padding(extra internal space) divs bottom
Comments
Post a Comment