dongwen3437 2016-08-24 09:43
浏览 62

分享后社交分享内容不显示?

Hi Everyone ,

I am using aw blog in our magento i need to create a social sharing option in our blog but currently only tittle are show in after i share with facebook its use logo and head content instead of blog content my code is given below

<?php
/**
 * aheadWorks Co.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://ecommerce.aheadworks.com/AW-LICENSE.txt
 *
 * =================================================================
 *                 MAGENTO EDITION USAGE NOTICE
 * =================================================================
 * This software is designed to work with Magento community edition and
 * its use on an edition other than specified is prohibited. aheadWorks does not
 * provide extension support in case of incorrect edition use.
 * =================================================================
 *
 * @category   AW
 * @package    AW_Blog
 * @version    1.3.17
 * @copyright  Copyright (c) 2010-2012 aheadWorks Co. (http://www.aheadworks.com)
 * @license    http://ecommerce.aheadworks.com/AW-LICENSE.txt
 */


?><?php $posts = $this->getPosts(); ?>
<div id="messages_product_view">
    <?php Mage::app()->getLayout()->getMessagesBlock()->setMessages(Mage::getSingleton('customer/session')->getMessages(true)); ?>
    <?php echo Mage::app()->getLayout()->getMessagesBlock()->getGroupedHtml(); ?>
</div>

<?php echo $this->getChildHtml('aw_blog_comments_toolbar'); ?>
<div class="post-lists">
<?php foreach ($posts as $post): ?>
    <div class="postWrapper">
        <!-- <div class="postTitle">
            <h2><a href="<?php echo $post->getAddress(); ?>" ><?php echo $post->getTitle(); ?></a></h2>
            <?php
                $postMonth =  date("M", strtotime($post->getCreatedTime()));
                $postDate =  date("d", strtotime($post->getCreatedTime()));
                $postYear =  date("Y", strtotime($post->getCreatedTime()));
                $dateMonthFormat = $postDate.' '.$postMonth.' '.$postYear;
            ?>
            <h3><?php echo $dateMonthFormat; ?></h3>
        </div> -->


        <?php
        $html_content = $post->getPostContent();

        $html_content = substr_replace($html_content,'<div class="postTitle"><h2>'.$post->getTitle().'</h2><h3>'.$dateMonthFormat.'</h3></div>',stripos($html_content,'<p class="blog-content">'),0);

        ?>

        <div class="postContent std"><?php echo $html_content; //$post->getPostContent(); ?></div>
          <!-- AddToAny BEGIN -->
<<div>
<p class="share"><span>Share</span></p>
               <ul class="sharing-links-cus">

<li><a href="javascript:popWin('https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode($post->getAddress()); ?>&t=<?php echo urlencode(post->getPostContent()); ?>', 'facebook', 'width=640,height=480,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes');" title="<?php echo $this->__('Share on Facebook') ?>"><img src="<?php echo $this->getSkinUrl();?>/images/f.png"></a></li>


<li><a href="" title="<?php echo $this->__('Share on Instagram') ?>"><img src="<?php echo $this->getSkinUrl();?>/images/i.png"></a></li>


<li><a href="javascript:popWin('https://www.linkedin.com/shareArticle?url=<?php echo urlencode($productUrl); ?>&title=<?php echo urlencode($productName); ?>', 'linked in', 'width=640,height=480,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes');" title="<?php echo $this->__('Share on Linked In') ?>"><img src="<?php echo $this->getSkinUrl();?>/images/l.png"></a></li>

                   <li><a href="javascript:popWin('http://twitter.com/home/?status=<?php echo urlencode($productName . ' (' . $productUrl . ')'); ?>', 'twitter', 'width=640,height=480,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes');" title="<?php echo $this->__('Tweet') ?>"><img src="<?php echo $this->getSkinUrl();?>/images/t.png"></a></li>
</ul>
</div>
<!-- Comment Section -->

        <?php echo $this->getBookmarkHtml($post) ?>
        <!-- <div class="tags"><?php echo $this->getTagsHtml($post) ?></div> -->
        <div class="postDetails">
            <?php if ($this->getCommentsEnabled()): ?>
                <?php echo $post->getCommentCount(); ?> <a href="<?php echo $post->getAddress(); ?>#commentBox" > <?php echo Mage::helper('blog')->__('Comments'); ?></a> <!-- | -->
            <?php endif; ?>
            <!-- <?php $postCats = $post->getCats(); ?>
            <?php if (!empty($postCats)): ?>
                <?php echo Mage::helper('blog')->__('Posted in'); ?>
                <?php foreach ($postCats as $data): ?>
                    <a href="<?php echo $data['url']; ?>"><?php echo $data['title']; ?></a>
                <?php endforeach; ?>
            <?php else: ?>
                <?php echo Mage::helper('blog')->__('Posted'); ?>
            <?php endif; ?><?php echo $this->__("By"); ?> <?php echo $post->getUser(); ?> -->
        </div>
    </div>
<?php endforeach; ?>
</div>
<?php echo $this->getChildHtml('aw_blog_comments_toolbar'); ?>

URl is making correct but content are not shared with facebook its share only logo and blog tittle please help me thanks for advance ...

  • 写回答

1条回答 默认 最新

  • dqajyxqem115006813 2016-08-24 10:14
    关注

    Please try this one.

    <?php
    /**
     * aheadWorks Co.
     *
     * NOTICE OF LICENSE
     *
     * This source file is subject to the EULA
     * that is bundled with this package in the file LICENSE.txt.
     * It is also available through the world-wide-web at this URL:
     * http://ecommerce.aheadworks.com/AW-LICENSE.txt
     *
     * =================================================================
     *                 MAGENTO EDITION USAGE NOTICE
     * =================================================================
     * This software is designed to work with Magento community edition and
     * its use on an edition other than specified is prohibited. aheadWorks does not
     * provide extension support in case of incorrect edition use.
     * =================================================================
     *
     * @category   AW
     * @package    AW_Blog
     * @version    1.3.17
     * @copyright  Copyright (c) 2010-2012 aheadWorks Co. (http://www.aheadworks.com)
     * @license    http://ecommerce.aheadworks.com/AW-LICENSE.txt
     */
    
    
    ?><?php $posts = $this->getPosts(); ?>
    <div id="messages_product_view">
        <?php Mage::app()->getLayout()->getMessagesBlock()->setMessages(Mage::getSingleton('customer/session')->getMessages(true)); ?>
        <?php echo Mage::app()->getLayout()->getMessagesBlock()->getGroupedHtml(); ?>
    </div>
    
    <?php echo $this->getChildHtml('aw_blog_comments_toolbar'); ?>
    <div class="post-lists">
    <?php foreach ($posts as $post): ?>
        <div class="postWrapper">
            <!-- <div class="postTitle">
                <h2><a href="<?php echo $post->getAddress(); ?>" ><?php echo $post->getTitle(); ?></a></h2>
                <?php
                    $postMonth =  date("M", strtotime($post->getCreatedTime()));
                    $postDate =  date("d", strtotime($post->getCreatedTime()));
                    $postYear =  date("Y", strtotime($post->getCreatedTime()));
                    $dateMonthFormat = $postDate.' '.$postMonth.' '.$postYear;
                ?>
                <h3><?php echo $dateMonthFormat; ?></h3>
            </div> -->
    
    
            <?php
            $html_content = $post->getPostContent();
            $html_content = substr_replace($html_content,'<div class="postTitle"><h2>'.$post->getTitle().'</h2><h3>'.$dateMonthFormat.'</h3></div>',stripos($html_content,'<p class="blog-content">'),0);           
            ?>
    
            <div class="postContent std"><?php echo $html_content; //$post->getPostContent(); ?></div>
              <!-- AddToAny BEGIN -->
        <div>
        <p class="share"><span>Share</span></p>
                       <ul class="sharing-links-cus">
    
        <li><a href="javascript:popWin('https://www.facebook.com/sharer/sharer.php?u=<?php echo urlencode($post->getAddress()); ?>&t=<?php echo urlencode($post->getPostContent()); ?>', 'facebook', 'width=640,height=480,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes');" title="<?php echo $this->__('Share on Facebook') ?>"><img src="<?php echo $this->getSkinUrl();?>/images/f.png"></a></li>
    
    
        <li><a href="" title="<?php echo $this->__('Share on Instagram') ?>"><img src="<?php echo $this->getSkinUrl();?>/images/i.png"></a></li>
    
    
        <li><a href="javascript:popWin('https://www.linkedin.com/shareArticle?url=<?php echo urlencode($productUrl); ?>&title=<?php echo urlencode($productName); ?>', 'linked in', 'width=640,height=480,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes');" title="<?php echo $this->__('Share on Linked In') ?>"><img src="<?php echo $this->getSkinUrl();?>/images/l.png"></a></li>
    
                           <li><a href="javascript:popWin('http://twitter.com/home/?status=<?php echo urlencode($productName . ' (' . $productUrl . ')'); ?>', 'twitter', 'width=640,height=480,left=0,top=0,location=no,status=yes,scrollbars=yes,resizable=yes');" title="<?php echo $this->__('Tweet') ?>"><img src="<?php echo $this->getSkinUrl();?>/images/t.png"></a></li>
        </ul>
        </div>
        <!-- Comment Section -->
    
        <?php echo $this->getBookmarkHtml($post) ?>
        <!-- <div class="tags"><?php echo $this->getTagsHtml($post) ?></div> -->
        <div class="postDetails">
            <?php if ($this->getCommentsEnabled()): ?>
                <?php echo $post->getCommentCount(); ?> <a href="<?php echo $post->getAddress(); ?>#commentBox" > <?php echo Mage::helper('blog')->__('Comments'); ?></a> <!-- | -->
            <?php endif; ?>
            <!-- <?php $postCats = $post->getCats(); ?>
            <?php if (!empty($postCats)): ?>
                <?php echo Mage::helper('blog')->__('Posted in'); ?>
                <?php foreach ($postCats as $data): ?>
                    <a href="<?php echo $data['url']; ?>"><?php echo $data['title']; ?></a>
                <?php endforeach; ?>
            <?php else: ?>
                <?php echo Mage::helper('blog')->__('Posted'); ?>
            <?php endif; ?><?php echo $this->__("By"); ?> <?php echo $post->getUser(); ?> -->
        </div>
    </div>
    <?php endforeach; ?>
    </div>
    <?php echo $this->getChildHtml('aw_blog_comments_toolbar'); ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line