在点击功能joomla上添加1个文章

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:

  • Articles Category Module
  • Articles - Newsflash Module

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.