Hi guys i have some trouble here.
<a class="anything" href="another/website">Take me to this product</a>
This button or link over here is added to every article in my joomla site and i have constructed every article to display diffrent products, and the link will take me to the product in my webshop.
My problem here is i need to have a toplist on my site based on article hits.
Basicly i want the link up there to add one hit to the specific article its in onClick
You could display articles in a module using:
Both have an option to Order Results by Hits .
To get the url part from module output you have to open module code and add a preg_match() that would search for <a> ... </a>
part.
An example would be:
<?php
$pattern = "/<a.*?>(.*)<\/a>/";
preg_match($pattern, $string, $url); // $string would contain module output
print_r($url);
?>
This tutorial may also help you: Find URLs in Text, Make Links .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.