Jump to content

Recommended Posts

Hi, I have spent the last few hours trying to solve this on my own, but I am not a php programmer. I'm a pre-med student who should be studying chemistry and math, but I won't be able to focus until I figure this out. How can I alter this code from blog_item.php (a standard file in a joomla template) to have the "read more" link appear at the end of the intro text as opposed to in its own <p> tag?

 

Current generated output:

<p>Some intro text for a blog entry goes here.</p>
<p class="readmore"><a href="link_to_article.html">Read more...</a></p>

 

Desired output:

<p>Some intro text for a blog entry goes here. <a class="readmore" href="link_to_article.html">Read more...</a></p>

 

I've modified and remodified this code for hours to no avail. Obviously, I can figure out how to make the "read more" link just an anchor tag by moving the class="readmore" to the anchor tag and removing the surrounding <p> tags, but I can't figure out how to get it to appear within the introtext <p> tags. Can anyone help me understand how to rewrite this?

 

<?php echo $this->item->introtext; ?>

<?php if ($params->get('show_readmore') && $this->item->readmore) :
if ($params->get('access-view')) :
	$link = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug, $this->item->catid));
else :
	$menu = JFactory::getApplication()->getMenu();
	$active = $menu->getActive();
	$itemId = $active->id;
	$link1 = JRoute::_('index.php?option=com_users&view=login&Itemid=' . $itemId);
	$returnURL = JRoute::_(ContentHelperRoute::getArticleRoute($this->item->slug));
	$link = new JURI($link1);
	$link->setVar('return', base64_encode($returnURL));
endif;
?>
<p  class="readmore">
			<a href="<?php echo $link; ?>">
				<?php if (!$params->get('access-view')) :
					echo JText::_('COM_CONTENT_REGISTER_TO_READ_MORE');
				elseif ($readmore = $this->item->alternative_readmore) :
					echo $readmore;
					echo JHTML::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
				elseif ($params->get('show_readmore_title', 0) == 0) :
					echo JText::sprintf('COM_CONTENT_READ_MORE_TITLE');	
				else :
					echo JText::_('COM_CONTENT_READ_MORE');
					echo JHTML::_('string.truncate', ($this->item->title), $params->get('readmore_limit'));
				endif; ?></a>
</p>
<?php endif; ?>

 

Thank you in advance!

Link to comment
https://forums.phpfreaks.com/topic/228840-joomla-16-help/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.