New answers tagged

1

A few pointers to offer: When checking the existence of a substring in a string, the PHP documentation advises: Note: If you only want to determine if a particular needle occurs within haystack, use the faster and less memory intensive function strpos() instead. So it is best practice to use if (strpos($result->href, 'com_content') !== false) { ...


3

I would have preferred to just suggest some touch ups to your snippet, but there is too much for me to address in your answer as a comment and I'd rather explain fully. Instead, I'll post this new answer which will review and clean up your assumed-working coding attempt for the benefit of you and future researchers. You are declaring $images = json_decode($...


1

The solution to my question. I think is valid: <?php $images = json_decode($item->images); ?> <span itemprop="image" itemscope itemtype="https://schema.org/ImageObject"> <link itemprop="url" href="<?php // Create new DOMDocument object. $dom = new DOMDOcument; // Load article text into DOMDocument. $dom->loadHTML($item->...


Top 50 recent answers are included