Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8967463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:14:56+00:00 2026-06-15T17:14:56+00:00

I have the following code inside mytemplate/html/com_content/featured/default.php <?php if (!empty($this->lead_items)) : ?> <div class=<?php

  • 0

I have the following code inside mytemplate/html/com_content/featured/default.php

<?php if (!empty($this->lead_items)) : ?>
    <div class="<?php echo $this->pageclass_sfx;?>">
<div class="block-head">
        <h2><?php echo $this->escape($this->params->get('page_heading')); ?></h2>
        <a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catslug)); ?>" class="more">all news</a>
    </div><!-- .block-head -->
<?php foreach ($this->lead_items as &$item) : ?>
    <dl>
        <dt>
        <?php 
            $params = JComponentHelper::getParams( 'com_content' );
            $this->item = &$item;
            $images = json_decode($item->images);
        ?>  
        <?php  if (isset($images->image_intro) and !empty($images->image_intro)) : ?>
            <?php $imgfloat = (empty($images->float_intro)) ? $params->get('float_intro') : $images->float_intro; ?>
                    <a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>" class="img-intro-<?php echo htmlspecialchars($imgfloat); ?>">
                    <img <?php if ($images->image_intro_caption):
                    echo 'class="caption"'.' title="' .htmlspecialchars($images->image_intro_caption) .'"';
                endif; ?>
                src="<?php echo htmlspecialchars($images->image_intro); ?>" alt="<?php echo htmlspecialchars($images->image_intro_alt); ?>"/>
            </a>
        <?php endif; ?>
        </dt>
        <dd>
            <var class="date"><?php echo JHtml::_('date', $this->item->publish_up, JText::_('DATE_FORMAT_LC')); ?></var>
            <h3><a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>" class="<?php if($this->params->get('page_heading') == 'projects'){echo 'more';}; ?>"><?php echo $this->item->title; ?></a></h3>
            <?php echo $this->item->introtext; ?>
            <div class="news-link clearfix">
                <a href="<?php echo JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid)); ?>" class="more"><?php  echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE'); ?></a>
                <div class="line"></div>
            </div>
        </dd>
    <?php
        $leadingcount++;
    ?>
    </dl>
<?php endforeach; ?>

All works fine, except the link to category news. Here it is:

<a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catslug)); ?>" class="more">all news</a>

How to make it work?

Thank you.


Thank you Lodder for your help. I used your code, just added break to it

<div class="block-head">
    <h2><?php echo $this->escape($this->params->get('page_heading')); ?></h2>
    <?php foreach ($this->lead_items as &$item) :
          $this->item = &$item;
          $title = $this->escape($this->item->category_title);
          echo '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catid, $this->item->catid)).'" class="more">all '.$title.'</a>';
          break;
     endforeach; ?>
</div><!-- .block-head -->
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:14:58+00:00Added an answer on June 15, 2026 at 5:14 pm

    The only was I was able to do it was like this:

    <div class="block-head">
        <h2><?php echo $this->escape($this->params->get('page_heading')); ?></h2>
        <?php foreach ($this->lead_items as &$item) :
                  $this->item = &$item;
                  echo '<a href="'.JRoute::_(ContentHelperRoute::getCategoryRoute($this->item->catid, $this->item->catid)).'">all news</a>';
               endforeach; ?>
    </div><!-- .block-head -->
    

    It has to be includes inside the foreach statement and contain $this->item = &$item; before it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code inside a class: this.buttons = { cancelButton:{buttonId: cancelButton, buttonText:Cancel,
Inside my aspx file, I have the following html code inside an repeater: <div
I have the following code inside the _forms view. <div class=field> Shop: <%= f.collection_select
I have the following code inside the body of my index.php page: echo Begin
I have the following code inside a static method in a static class: Random
I have the following code inside a class. (It's coffeescript-- and it's for a
I have the following code inside a C++ class: class Features { #define Feature_Size_A
I have the following code inside the NSData+AES256 class. I am trying AES CBC
i've been working on this question since yesterday, i have the following code.. <?php
I have following code: <div id=comments class=clearfix> <div class=conversation box_round_s box_shadow clearfix mtm> <div

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.