Search
Other Snippets questions
Forum

Joomla 4 not rendering correctly

Jonathan Asbell's Avatar Jonathan Asbell
Hello Peter.

I have this snippet
[%snippet alias="button-model" url="https://www.aol.com" query="turkey" icon="fas fa-phone-alt" text="my button text"%]

it referrs to (calls) another snippet
<a href="[%snippet alias="%url%"%]?[%snippet alias="%query:empty-query%"%]"><button class="uk-button uk-button-primary"><i class="%icon%"></i>&nbsp;&nbsp;%text%</button></a>

If you see my homepage it does not render correctly. I have used this technique in my other website.

Also, there are 3 snippets configured to be inserted in the head tag but its not working
zoho-salesiq
zoho-pagesense
zoho-marketing-automation

Confidential information:
(hidden)
Peter van Westen's Avatar Peter van Westen ADMIN
It is probably due to the system plugin ordering. Try changing the ordering of the plugins in question.
See: regularlabs.com/blog/242-plugin-order-is-important
Please post a rating at the Joomla! Extensions Directory
Jonathan Asbell's Avatar Jonathan Asbell
I moved the to the top. No effect
Peter van Westen's Avatar Peter van Westen ADMIN
You have not set up any variables in the snippets yet.
See: docs4.regularlabs.com/snippets/going-fur...ing-dynamic-snippets
Please post a rating at the Joomla! Extensions Directory
Jonathan Asbell's Avatar Jonathan Asbell
Thanks Pete. Thats a new mechanism I didnt know about.

So look at this:

See snippet "button-call"
1) it pulls in snippets
- phone-number-main
- phone-number-main-display
2) then it passes variables to "button-model"

Then look at the homepage and you will see the button rendering fine, but the url is messed up
Peter van Westen's Avatar Peter van Westen ADMIN
You are trying to nest snippets inside snippets inside snippets. Not sure why you would want to do it all like this.

I have set the phone number and phone number display values as defaults for the 2 variables in button-call.
That means you don't need the 2 snippets 'phone-number-main' and 'phone-number-main-display' separately.

This works and I hope it fits your needs.
Please post a rating at the Joomla! Extensions Directory
Jonathan Asbell's Avatar Jonathan Asbell
HA! Im testing your architecture!
The reason is that I use snippets for a single source of information....like a tree structure.
Phone numbers change, names change...I like to have a single place to change it all. Thats why.


Maybe you can provide a way to standardize this for certain global values like:
company
-name
-address
----------
main
----------
-page url
-phone
-email
----------
support
----------
-page url
-phone
-email
----------
sales
----------
-page url
-phone
-email
Jonathan Asbell's Avatar Jonathan Asbell
What is NOT working are the snippets that go into the head. They are not rendering
[%snippet script-zoho-salesiq%]
[%snippet script-zoho-pagesense%]
[%snippet script-zoho-marketing-automation%]

I put them in the index.php template file
Peter van Westen's Avatar Peter van Westen ADMIN
That all depends on in what way do you want to use this in your content.
Do you plan to have multiple snippets for every section?
Are these all to be used for the contact button?
Please post a rating at the Joomla! Extensions Directory
Peter van Westen's Avatar Peter van Westen ADMIN
Regarding the snippets in the head... enable the "Enable in html head" setting in the items.
Please post a rating at the Joomla! Extensions Directory
Jonathan Asbell's Avatar Jonathan Asbell
Hey Pete.

RE snippets usage--------------------
Yes I am trying to standardize everything as a practice. When I want a call button I would just select the snippet I made [%snippet call-button%] which would pull in the same href, display number, icon, etc etc. If I wanted to change the phone number across the website (happens all the time now because of spam and 10DLC) I would just change the number and the number display....no more hunting and searching and verifying and replacing.

RE snippets in head------------------
I did what you suggested. but they are not showing up

This plugin save me YEARS of time! Thanks!
Peter van Westen's Avatar Peter van Westen ADMIN
But will you have more than 1 snippet using the same phone number?
So apart from just a call-button?
Please post a rating at the Joomla! Extensions Directory
Jonathan Asbell's Avatar Jonathan Asbell
No just 1 number. The display and at times the tel:// link would be in the footer, in content, anywhere. That way I dont have to hunt it down. Wherever it is is where it replaces, and I wont be accidentally making mistakes like with REReplacer. I would have 1 with just the number and another with the number and link
Jonathan Asbell's Avatar Jonathan Asbell
I dont even understand how the number is displaying when the snippets for the number and link are off
Jonathan Asbell's Avatar Jonathan Asbell
The script snippets are NOT rendering in the head tag
Peter van Westen's Avatar Peter van Westen ADMIN
Let's tackle 1 issue at the time.

So the structure of the snippets.. check the Variables tab of the button-call snippet.
Please post a rating at the Joomla! Extensions Directory
Jonathan Asbell's Avatar Jonathan Asbell
Ok I saw what you did. Only issue is that it is hardcoding that default. I would NEVER remember where to find that its so buried =). But I understand. Honestly I would like to set it up so that the number value and the number display are each their own snippet. That would be my preference.

The bigger problem is the sippets in the <head> tag
Peter van Westen's Avatar Peter van Westen ADMIN
I recommend against nesting the snippets that way. Probably better to do the main stuff via ReReplacer (the handling of the tags), and output the HTML with Snippet tags inside with that (which will output the phone numbers and such).
The n you could also simply do something like:
[button-call]
Instead of:
[%snippet alias="button-call"%]

Regarding the snippets in the head (which I would also recommend ReReplacer for, but whatever you want...)
Where can I find where you placed the Snippet tags?
Please post a rating at the Joomla! Extensions Directory
Jonathan Asbell's Avatar Jonathan Asbell
Thanks Pete. I had them in the index.php in my child theme but took them out because it didnt work
Peter van Westen's Avatar Peter van Westen ADMIN
Probably it was because the syntax was not correct.
It is not:
[%snippet script-zoho-salesiq%]
But:
[%snippet alias="script-zoho-salesiq"%]
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription