Minifrontpagepro

Thanks to your support, I modified the default template via Override so that if there is a link in the article, the link is opened, otherwise the text of the article is displayed.
In case the text of the article is displayed, the visit counter is incremented.
If possible, I would like the visit counter to be incremented even if the link is opened.
Thanks for your assistance
Luca
1 year 3 months ago #1 by Luca

Please Log in or Create an account to join the conversation.

  • Posted by TemplatePlazza (5193) Offline
Hi Luka can you explain me in more detail with 

so that if there is a link in the article, the link is opened,

Did you mean it open particular content/modal?
1 year 3 months ago #2 by TemplatePlazza

Please Log in or Create an account to join the conversation.

Hi,
i changed the override code as below
in this way when I click on an article, if there is a link in the article (for example to a PDF), the PDF is opened, otherwise the text of the article is displayed.
I would like the counter of visits to the article to be incremented also when the pdf is viewed and not only when the text of the article is viewed
see also attached file.
thanks
$urls = json_decode($item->urls);
if($urls->urla !== "")        {
  $url_or_article = $urls->urla;
  } else
{   $url_or_article = $item->link;  }
.........
<a href="<?php echo $url_or_article; ?>" <?php if($urls->urla !== "") { ?>target ="_blank" <?php } ?> class="mfp_thumb_pos_<?php echo $default_thumbnail_position; ?>" itemprop="url"><?php echo $thumb_img[0]; ?></a>
1 year 3 months ago #3 by Luca

Please Log in or Create an account to join the conversation.

  • Posted by TemplatePlazza (5193) Offline
Ah I see. Unfortunately this is not something supported by Joomla system because technically you are visiting a page that is outside the Joomla system. If you know javascript maybe you can do it with javascript, but I think it'll be quite tricky.
1 year 3 months ago #4 by TemplatePlazza

Please Log in or Create an account to join the conversation.

  • Posted by TemplatePlazza (5193) Offline
Anyway, I haven't tested it, but I think I have an easier solution by using iframe.

Add this code outside the loop foreach
<iframe name="hitframe" style="display:none;"></iframe>

and change the link into something like this :
<a href="<?php echo $item->link; ?>" <?php if($urls->urla !== "") { ?> onclick="window.open('<?php echo $urls->urla; ?>');" target="hitframe" <?php } ?> class="mfp_thumb_pos_<?php echo $default_thumbnail_position; ?>" itemprop="url"><?php echo $thumb_img[0]; ?></a>

So technically when the link is clicked, it will open two links. The first one is the original article's link that will open the article inside a hidden iframe (and will add a hit/increase the visit counter), and the other one is link to the file that will be opened in a new window.
1 year 3 months ago #5 by TemplatePlazza

Please Log in or Create an account to join the conversation.

Thanks for the suggestion, I'm still sik, I'll try the change as soon as I can.
1 year 3 months ago #6 by Luca

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum