JonnYnnoJ JonnYnnoJ - 1 year ago 133
CSS Question

Prefix a URL with CSS

I am pulling the content of a bunch of customer reviews from a website using a tiny piece of PHP, though the title of each review contains the URL to the original review on the website that it comes from, which is great, except that the URL that is pulled does not contain to originating websites full address.

So on my website, the link does not work. You can see it in action here: try clicking one of the review titles.

Is there any way to fix this with CSS? I think all it needs is a prefix to the original site. What is pulled from the originating site is just e.g. "/job/view/1971050", which when clicked tries to find this on my site (obviously won't find it). So I need to prefix it with "" so that it works.

If the above isn't possible, a last resort might be to just disable the URL (without removing the title text itself) just so that there isn't a bunch of broken links.

PHP being used:

$target_url = "";
$html = new simple_html_dom();
foreach($html->find('li[class=job-view-feedback]') as $jobviewfeedback){
echo $jobviewfeedback;

I'm using a modified version of this tutorial for this:
Which makes use of the a "helper" called "Simple HTML DOM".

Any help or pointers in the right direction are much appreciated, thanks in advance!

Answer Source

Can you edit that PHP? If so, do a PHP string replace on $jobviewfeedback... search for href="/ and replace with href="

so instead of

echo $jobviewfeedback;

you'd have

echo str_replace('href="/', 'href="', $jobviewfeedback);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download