schema.org Category view: 5 errors for each item/article (only 1 in item view)

More
13 hours 29 minutes ago - 13 hours 20 minutes ago #86285 by iamrobert
I'm still in Joomla 4 at the moment but am upgrading to J5 in the coming month.

Here’s a recent build of  global-logic.php - it also includes an item.php of how I insert the code.


You can place the file in any folder you like, and you can include it in your FLEXIContent template using modern Joomla 4/5 syntax:
Code:
require_once JPATH_SITE . '/components/com_flexicontent/templates/iamrobert/common-code/item-header-logic.php';

The old . DS .  syntax is no longer needed.

I keep my own reusable code blocks in a folder called iamrobert under:

/components/com_flexicontent/templates/

This folder is not an actual FLEXIContent template - it’s simply a clean way to store reusable logic across multiple client projects.

If you're interested in the theory behind this setup, see here:  github.com/Lyquix/flexicontent_templates

Below is an example of how I structure my reusable blocks
   

Where in item.php should I insert the require_once line?

You can place it anywhere before you use the variables or functions from global-logic.php.
I put it near the top of item.php, just after the opening PHP tag.



Do I need to put global-logic.php inside the same template folder?
Not necessarily — you can put it anywhere.
You only need to adjust the path in  require_once  so Joomla knows where to find it.
 
Last edit: 13 hours 20 minutes ago by iamrobert.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.345 seconds
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save