3

How can I use PHP echo to get the next or prev page article title or image in current page?

I tried change some code in article/default.php like:

<div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image"> <img
    <?php if ($images->image_fulltext_caption):
        echo 'class="caption"' . ' title="' . htmlspecialchars($images->image_fulltext_caption) . '"';
    endif; ?>
    src="<?php echo htmlspecialchars($images->image_fulltext); ?>" alt="<?php echo htmlspecialchars($images->image_fulltext_alt); ?>" itemprop="image"/> </div>

to

<div class="pull-<?php echo htmlspecialchars($imgfloat); ?> item-image"> <img
    <?php if ($images->image_fulltext_caption):
        echo 'class="caption"' . ' title="' . htmlspecialchars($images->image_fulltext_caption) . '"';
    endif; ?>
    src="<?php echo htmlspecialchars($next->images->image_fulltext); ?>" alt="<?php echo htmlspecialchars($images->image_fulltext_alt); ?>" itemprop="image"/> </div>

but it didn't work.

I don't want to change it in pagenavigation.php.

I'm using Joomla 3.4.

2

You could override the page navigation by creating a template override file in /templates/your_template/html/plg_content_pagenavigation/. Copy the file /plugins/content/pagenavigation/tmpl/default.php to this place and edit as needed. However since the plugin doesn't load the article pictures, you will not have the data available.

So the only solution is to replace the pagenavigation plugin with another one. I could imagine that there is such a plugin on JED, or you could create your own by copying the pagenavigation one and edit it.

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.