There is a site where articles are output from the database in a loop. Something like:
<?php foreach($article as $item):?> <div class="nazvanie_statii"><?=$item['title'];></div> <div class="kol_prosmotrov"><?=$item['view'];></div> <div class="text_statii"><?=$item['text'];></div> <a href="<?=base_url();?>index.php/article/<?=$item['title_en'];?>"/> <?php endforeach;>
There is also a jQuery function that counts the number of clicks on a block or link with the class .myObj and displays them in a block with the identifier- # counter.
<script type="text/javascript" language="javascript"> $(document).ready(function() { $('#myObj').click(function() { $('#counter').html(+$('#counter').html()+1); }); }); </script>
In general, this question arose - how to tie it to my link - <a href="<?=base_url();?>index.php/article/<?=$item['title_en'];?>"/>
?
After all, it is dynamic, each time is displayed on the title_en-title of the article in the transcription. Tell me, please, click on the idea. Thank you in advance.
No one has any ideas? Like the idea should not be difficult to implement ... Or is it generally impossible on the fly ... only by adding the number of clicks in the database and the subsequent output from the database in the <div class="kol_prosmotrov"><?=$item['view'];></div>
I realized that I was writing nonsense, because after reloading the page the counter will reset. Then it turns out only through?