-->
julis

Sharetronix Extension - Like Dislike Part 4

in this post i will explain the change that i've made in View part
first add this in system\languages\en\inside\global.php
'postlike' => 'Like',
'postdislike' =>'Dislike',

in this version i just using default theme, and i haven't change the mobile theme yetchange files themes\default\hmtl\single_post.php
after

<?= $D->p->show_share_link() ?>

add this, (sorry this is programmer theme made, not web designer ) :D
&middot;
<?php if($D->p->post_likesnum > 0 || $D->p->post_dislikesnum > 0){ ?>
    <?php echo $D->p->post_likesnum.' '.$this->lang('postlike') ?>
    /
    <?php echo $D->p->post_dislikesnum.' '.$this->lang('postdislike') ?>
<?php } ?>
    <br>
<?php if($D->p->is_post_disliked()){ ?>
    <a href="javascript:;" id="postlink_like_<?= $D->p->post_tmp_id ?>" onfocus="this.blur();" onclick="post_like('<?= $D->p->post_tmp_id ?>');"><?= $this->lang('postlike') ?></a>
<? }else if($D->p->is_post_liked()){ ?>
    <a href="javascript:;" id="postlink_dislike_<?= $D->p->post_tmp_id ?>" onfocus="this.blur();" onclick="post_dislike('<?= $D->p->post_tmp_id ?>');"> <?= $this->lang('postdislike') ?></a>
<?php }else{ ?>
    <a href="javascript:;" id="postlink_like_<?= $D->p->post_tmp_id ?>" onfocus="this.blur();" onclick="post_like('<?= $D->p->post_tmp_id ?>');"><?= $this->lang('postlike') ?></a>
    /
    <a href="javascript:;" id="postlink_dislike_<?= $D->p->post_tmp_id ?>" onfocus="this.blur();" onclick="post_dislike('<?= $D->p->post_tmp_id ?>');"> <?= $this->lang('postdislike') ?></a>
    <?php } ?>

now change file themes\default\html\view.php
after

<?= $D->post->show_share_link() ?>

add this

&middot;
<?php if($D->post->post_likesnum > 0 || $D->post->post_dislikesnum > 0){ ?>
    <?php echo $D->post->post_likesnum.' '.$this->lang('postlike') ?>
    /
    <?php echo $D->post->post_dislikesnum.' '.$this->lang('postdislike') ?>
<?php } ?>
    <br>
<?php if($D->post->is_post_disliked()){ ?>
    <a href="javascript:;" id="postlink_like_<?= $D->post->post_tmp_id ?>" onfocus="this.blur();" onclick="post_like('<?= $D->post->post_tmp_id ?>');"><?= $this->lang('postlike') ?></a>
<? }else if($D->post->is_post_liked()){ ?>
    <a href="javascript:;" id="postlink_dislike_<?= $D->post->post_tmp_id ?>" onfocus="this.blur();" onclick="post_dislike('<?= $D->post->post_tmp_id ?>');"> <?= $this->lang('postdislike') ?></a>
<?php }else{ ?>
    <a href="javascript:;" id="postlink_like_<?= $D->p->post_tmp_id ?>" onfocus="this.blur();" onclick="post_like('<?= $D->post->post_tmp_id ?>');"><?= $this->lang('postlike') ?></a>
    /
    <a href="javascript:;" id="postlink_dislike_<?= $D->post->post_tmp_id ?>" onfocus="this.blur();" onclick="post_dislike('<?= $D->post->post_tmp_id ?>');"> <?= $this->lang('postdislike') ?></a>
    <?php } ?>


because this is long post i will continue to next post, to explain change Javascript side
julis
julis
Load comments