*

MB Themes

Re: adsense and blog ?
« Reply #15 on: April 07, 2021, 09:53:40 AM »
@David
I think you should read at least very very basics about PHP. You've reopened PHP tag for HTML code.
Enable PHP error logging on your hosting and you will see errors instead of blank page.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

David Beaudoin

  • ****
  • 242 posts
  • https://abrutis.net
Re: adsense and blog ?
« Reply #16 on: April 07, 2021, 09:55:19 AM »
Without the PHP tag at the end it doesn't work and without any tags at all, I don't have the ad
Regards,
David
0640404083

*

David Beaudoin

  • ****
  • 242 posts
  • https://abrutis.net
Re: adsense and blog ?
« Reply #17 on: April 07, 2021, 09:56:08 AM »
Anyway, thank you for taking the time for me
Regards,
David
0640404083

*

MB Themes

  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

David Beaudoin

  • ****
  • 242 posts
  • https://abrutis.net
Re: adsense and blog ?
« Reply #19 on: April 07, 2021, 10:09:35 AM »
Yes I have already seen tutorials like that but it's always for writing... the cries, there is no problem I manage to do it it is to integrate my damn script that I cannot do it
Regards,
David
0640404083

*

cartagena68

  • ***
  • 71 posts
Re: adsense and blog ?
« Reply #20 on: April 07, 2021, 03:12:07 PM »
<?php
  $blog_id = Params::getParam('blogId');
  $blog = ModelBLG::newInstance()->getBlogDetail($blog_id);
  $author = ModelBLG::newInstance()->getAuthor($blog['fk_i_user_id']);
  $comments = ModelBLG::newInstance()->getComments($blog_id, 1);
  ModelBLG::newInstance()->updateBlogViews($blog_id);
?>


<script data-ad-client="ca-pub-5046117062556130" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

<?php  <-- THIS MUST GO


<div id="blg-body" class="blg-theme-<?php echo osc_current_web_theme(); ?>">
  <div id="blg-main" class="blg-content">
    <h1><?php echo blg_get_title($blog); ?></h1>

    <?php if(blg_get_subtitle($blog) <> '') { ?>
      <h2><?php echo blg_get_subtitle($blog); ?></h2>
    <?php } ?>

    <div class="blg-details">
      <?php if($blog['i_category'] > 0) { ?>
        <?php $blog_cat = ModelBLG::newInstance()->getCategoryDetail($blog['i_category']); ?>
        <div class="blg-detail-entry blg-detail-cat" <?php if($blog_cat['s_color'] <> '') { ?>style="background:<?php echo $blog_cat['s_color']; ?>;"<?php } ?>><?php echo blg_get_cat_name($blog_cat); ?></div>
      <?php } else { ?>
        <div class="blg-detail-entry blg-detail-cat"><?php _e('Uncategorized', 'blog'); ?></div>
      <?php } ?>

      <div class="blg-detail-entry"><?php echo date('j. M Y', strtotime($blog['dt_pub_date'])); ?></div>
      <div class="blg-detail-entry"><?php echo sprintf(__('%d views', 'blog'), $blog['i_view']); ?></div>
    </div>
 
 

    <div class="blg-content-text">
      <div class="blg-primary-img">
          <img src="<?php echo blg_img_link($blog['s_image']); ?>" alt="<?php echo osc_esc_html(blg_get_title($blog)); ?>" data-src="<?php echo blg_img_link($blog['s_image']); ?>"/>
      </div>

      <div class="blg-raw-text">
        <?php
          if(!blg_is_premium($blog)) {
            echo blg_get_description($blog);
          } else {
            echo osc_highlight(blg_get_description($blog), 800);
          }
        ?>
      </div>

      <?php if(blg_is_premium($blog)) { ?>
        <div class="blg-premium-cover"></div>
      <?php } ?>
    </div>

    <?php require 'premium.php'; ?>


    <?php if(blg_param('comment_enabled') == 1) { ?>
      <div class="blg-comments">
        <h2><?php _e('Comments', 'blog'); ?></h2>

        <?php if(count($comments) > 0) { ?>
          <?php $j = 0; ?>
          <?php foreach($comments as $c) { ?>
            <?php
              $j++;
              $cuser = User::newInstance()->findByPrimaryKey($c['fk_i_os_user_id']);
              $cauthor = ModelBLG::newInstance()->getUserByOsclassId($c['fk_i_os_user_id']);

              if(!$cauthor) {
                $is_author = false;
              } else {
                $is_author = true;
              }
            ?>


            <div class="blg-row<?php if($j == 1) { ?> blg-comment-first<?php } ?>">
              <div class="blg-comment-img">
                <?php
                  $cimg = '';

                  if($is_author) {
                    $cname = $cauthor['s_name'];
                    $cimg = blg_user_img($cauthor['s_image']);
                  } else {
                    $cname = (@$cuser['s_name'] <> '' ? $cuser['s_name'] : __('Anonymous', 'blog'));

                    if(function_exists('profile_picture_show')) {
                      if($c['fk_i_os_user_id'] > 0) {
                        $cimg = profile_picture_show(null, 'item', 200, null, $c['fk_i_os_user_id']);
                      }
                    }
                  }

                  if($cimg == '') {
                    $cimg = osc_base_url() . 'oc-content/plugins/blog/img/user/user-default.png';
                  }
                ?>

                <img src="<?php echo $cimg; ?>" alt="<?php echo osc_esc_html($cname); ?>" />
              </div>

              <div class="blg-comment-text">
                <div class="blg-comment-top">
                  <span class="blg-comment-user">
                    <?php if($is_author && @$cauthor['pk_i_id'] > 0) { ?>
                      <a href="<?php echo osc_route_url('blg-author', array('authorSlug' => osc_sanitizeString(blg_slug($cauthor['s_name'])), 'authorId' => $cauthor['pk_i_id'])); ?>" class="blg-comment-author-link"><?php echo $cname; ?></a>
                    <?php } else { ?>
                      <?php echo $cname; ?>
                    <?php } ?>
                  </span>

                  <span class="blg-comment-del"><?php _e('on', 'blog'); ?></span>
                  <span class="blg-comment-date"><?php echo date('j. M Y', strtotime($c['dt_pub_date'])); ?></span>
                </div>

                <div class="blg-comment-bot"><?php echo strip_tags($c['s_comment'], '<br>'); ?></div>
              </div>
            </div>
          <?php } ?>
        <?php } else { ?>
          <div class="blg-row blg-empty"><?php _e('No comments has been added on this post', 'blog'); ?></div>
        <?php } ?>
      </div>

      <div class="blg-new-comment">
        <h3><?php _e('Add new comment', 'blog'); ?></h3>

        <?php if(!osc_is_web_user_logged_in()) { ?>
          <div class="blg-row blg-not-logged"><?php _e('You must be logged in to add new comment', 'blog'); ?>. <a href="<?php echo osc_user_login_url(); ?>"><?php _e('Log in', 'blog'); ?></a></div>

        <?php } else { ?>
          <form class="nocsrf" method="POST" name="blg_new_comment" action="<?php echo osc_route_url('blg-action', array('blgPage' => 'comment')); ?>">
            <input type="hidden" name="fk_i_blog_id" value="<?php echo $blog_id; ?>" />

            <div class="blg-row">
              <label for="s_name"><?php _e('Your name', 'blog'); ?></label>
              <input type="text" name="s_name" id="s_name" value="<?php echo osc_esc_html(osc_logged_user_name()); ?>" readonly required/>
            </div>

            <div class="blg-row">
              <label for="s_comment"><?php _e('Comment', 'blog'); ?></label>
              <textarea name="s_comment" id="s_comment" required></textarea>
            </div>

            <button class="blg-btn blg-btn-primary" type="submit" title="<?php echo osc_esc_html(__('Submit', 'blog')); ?>"><i class="fa fa-check"></i> <?php echo osc_esc_html(__('Submit', 'blog')); ?></button>
          </form>
        <?php } ?>
      </div>
    <?php } ?>
  </div>

  <?php require_once 'sidebar.php'; ?>
</div>

*

David Beaudoin

  • ****
  • 242 posts
  • https://abrutis.net
Re: adsense and blog ?
« Reply #21 on: April 07, 2021, 03:24:54 PM »
thanks but i have already tried. It does not work. Here I am saving my site so Filezilla is busy but I will try again afterwards!
Regards,
David
0640404083