custom phtml call

How to call blog_slide.phtml on home page or in static block.

{{block type="core/template" template="magentothem_blog/blog_slide.phtml"}}

i tried this but nothing happens.

$enabled_slide = Mage::getStoreConfig('blog/slide/enabled');
    $itemsTablet = $this->getConfig('itemsTablet');
    $itemsMobile = $this->getConfig('itemsMobile');
    $show_image = $this->getConfig('showimage');
    $show_title = $this->getConfig('showtitle');
    $show_author = $this->getConfig('showauthor');
    $show_time = $this->getConfig('showtime');
    $show_shortcontent = $this->getConfig('showshortcontent');
    $showcomment = $this->getConfig('showcomment');
    $show_readmore = $this->getConfig('showreadmore');

    echo "item".$itemsTablet;
    <?php $post = $this->getRecent()->getFirstItem(); ?>
    <?php if($post): ?>
        <div class="menu-recent">
        <!--<div class="container">-->
            <div class="blog-titles ma-title"><h2>FROM THE BLOG</h2></div>
            <div class="item-inner">
                    <div class="blog-image">
                        <?php if($show_image): ?>
                            <?php if($post->getAddress()): ?><a href="<?php echo $post->getAddress(); ?>" ><?php endif; ?>
                            <?php echo '<img alt="" src="'.Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA). $post->getThumbnailimage().'"/>'; ?>
                            <?php if($post->getAddress()): ?></a><?php endif; ?>
                        <?php endif; ?>
                        <div class="time-conment">
                            <?php if($show_author) echo '<span class="author">By '.$post->getUser().'</span>'; 
                                if($show_author && $show_time) echo ''; 
                                if($show_time) echo '<span class="date-time"><i class="fa fa-calendar"></i>' .date("d M Y", $date).'</span>'; ?>
                            <?php if($showcomment) echo '<span class="comments"><i class="fa fa-comments-o"></i>'.$this->getcountcomment($post->getPostId()) .' comments </span>' ?>

                    <div class="blog-content">
                        <?php if($show_title): ?> <h3 class="blog-title"><a href="<?php echo $post->getAddress(); ?>" ><?php echo $post->getTitle() ?></a></h3> <?php endif; ?>
                        <?php $s = $post->getCreatedTime(); $date = strtotime($s); ?>
                        <?php if($show_shortcontent) echo '<p>' .strip_tags($this->getContentBlogSidebar($post->getShortContent(),120)) .'</p>';?>

                        <?php if($show_readmore): ?> <a class="readmore" href="<?php echo $post->getAddress(); ?>">Read more <i class="fa fa-caret-right"></i></a> <?php endif; ?>

    <?php else: ?>
    <p class="note-msg"><?php echo $this->__('There are no blog matching the selection.') ?></p>
    <?php endif; ?>
<?php endif; ?>
  • share blog_slide.phtml code – Murtuza Zabuawala Jun 7 '17 at 7:43
  • Did you check homepage by enabling template path hint from admin if your phtml file is being rendered? – Jaimin Sutariya Jun 7 '17 at 8:16
  • Yes i did but no phtml file related to this shown. is there any thing wrong in type="...." – inrsaurabh Jun 8 '17 at 13:23

Add this in local.xml:

   <reference name="content">
      <block type="core/template" name="my.new.custom.block" after="-" template="path_to_your_template.phtml"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.