Search
Other Snippets questions
Forum

Joomla 4 not rendering correctly

Jonathan Asbell's Avatar Jonathan Asbell
PAGE
------------------
"buying-from-an-investor"
www.realplaces.io/topics/buying-from-an-investor
you will see the snippet commented out in the second-to-bottom text builder element

SNIPPETS
------------------
modal-process-buying
url-process-buying
modal-structure

Confidential information:
(hidden)
Peter van Westen's Avatar Peter van Westen ADMIN
The login no longer works. When trying to reset the password, I do not get an email. So looks like the account is not there anymore or is blocked.

On the page you gave: where is the snippet used in question? Is this 'modal-process-buying'? I don't see the issue.
Please make it easy for me to find what I need, instead of making me guess and search through the way-too-many snippets you are using.
Please post a rating at the Joomla! Extensions Directory
Jonathan Asbell's Avatar Jonathan Asbell
Sorry Pete. I hope I fixed the login below

PAGE
------------------
"buying-from-an-investor"
www.realplaces.io/topics/buying-from-an-investor
you will see the snippet commented out in the second-to-bottom text builder element

SNIPPETS
------------------
modal-process-buying
url-process-buying
modal-structure

Confidential information:
(hidden)
Peter van Westen's Avatar Peter van Westen ADMIN
In snippet "modal-structure" you are trying to place %url% and %text%. But you did not create any variables for it in the snippet.
Please read the documentation (again) on how the variables work in the Joomla 4 version of Snippets:
docs4.regularlabs.com/snippets/going-fur...ing-dynamic-snippets
Please post a rating at the Joomla! Extensions Directory
Jonathan Asbell's Avatar Jonathan Asbell
I set up ("declared") variables I would use in the snippet. I did not DEFINE that value in variables because its different when different snippets call it
Peter van Westen's Avatar Peter van Westen ADMIN
No idea what you mean by that... but does it work now?
Please post a rating at the Joomla! Extensions Directory
Jonathan Asbell's Avatar Jonathan Asbell
No it doesnt work. What I meant is that I entered the variable name but not the value - the value is coming in from another snippet
Peter van Westen's Avatar Peter van Westen ADMIN
You still haven't set stuff up correctly.

In snippet 'modal-process-buying' you have:
[%snippet alias="modal-structure" url="%url-process-buying%" icon="fa-search-dollar" text="Preview Buying Process"%]
You are referencing the variable %url-process-buying% here, which is empty.
I think you want to include the snippet 'url-process-buying' here. So change it to:
[%snippet alias="modal-structure" url="[[snippet:url-process-buying]]" icon="fa-search-dollar" text="Preview Buying Process"%]

Please double-check your snippets to see if you are using variables and references to other snippets correctly.
Please post a rating at the Joomla! Extensions Directory
Jonathan Asbell's Avatar Jonathan Asbell
It worked!!!!
Pete I just dont understand it. Maybe Im not clear on how the mechanism/structure/detail works. Let me try to explain to see if I understand correctly:

I used [%snippet alias="modal-process-buying"%] in the page which calls "modal-process-buying"

in snippet "modal-process-buying" I reserved variable "url-process-buying" in the variable tab and matched it in the snippet tag as "[[snippet:url-process-buying]]" so that the snippet would officially know to go get and use the value of url-process-buying.

in snippet "modal-structure" I reserved variables "text","url", and "icon" in the variable tab and matched it in the snippet tag as
{modal url="%url%"}<button class="uk-border-pill uk-width-auto" style="line-height:inherit;"><i class="fa %icon% fa-lg"></i>&nbsp;&nbsp;%text%</button>{/modal}

Did I get that correct?
Peter van Westen's Avatar Peter van Westen ADMIN
Indeed, it looks like you still don't understand it. I'll try to explain it again.

There are 3 different types of tags that are at play here:
- The main {snippet} tags (in your case [%snippet%] tags, as you are not using the default tag characters)
- The %variable% tags
- The [[snippet:...]] Dynamic tags

The main {snippet} tags
This will output the content of the given snippet. You can also pass on the values of variables used inside the snippet.

The %variable% tags
If you want to use %variable% tags inside a snippet contents, you have to create these under the Variables tab.
If you pass the value of a variable via the main {snippet} tag (as mentioned above), the snippet will use that value. Otherwise, it will use the default defined under the Variables tab.

The [[snippet:...]] Dynamic tags
These do pretty much the same thing as the main {snippet} tags.
Except, you can ONLY use these inside the contents of a snippet and/or in the default values of the variables.
The advantage of these is also that you can place these inside a normal {snippet} tag inside the snippet content (when nesting snippets).


Having said all that, let's look at your snippet "modal-process-buying":
[%snippet alias="modal-structure" url="[[snippet:url-process-buying]]" icon="fa-search-dollar" text="Preview Buying Process"%]
Here you are using the output of snippet "url-process-buying" to pass along to the snippet "modal-structure" as the variable "url".
In this "modal-process-buying" snippet you are NOT using any %variable% tags in the content.
So the Variables tab should be empty.
You should NOT create a variable for 'url-process-buying' in this snippet.

So:
1) Calling [%snippet alias="modal-process-buying"%] (not passing along any variables).
2) Snippet "modal-process-buying" calls [%snippet alias="modal-structure" ...%], it passes along values for variables "url", "icon" and "text". It uses the output of snippet "url-process-buying" for variable "url". (It does not use any variables itself.)
3) Snippet "modal-structure" uses 3 variables internally: "url", "icon" and "text". So these are defined under the Variables tab, and used in the contents of the snippet via %url%, %icon% and %text%.
Please post a rating at the Joomla! Extensions Directory
Jonathan Asbell's Avatar Jonathan Asbell
Im following this Pete ......and I cant get this to work

-----------------------------------------------
Main triggering snippet
-----------------------------------------------
[%snippet alias="button-tools-seller-investor-questions"%]

-----------------------------------------------
button-tools-seller-investor-questions snippet
-----------------------------------------------
[%snippet alias="popup-structure" handler="[[snippet:popup-onclick]]" url="[[snippet:url-tools-seller-questions-for-investor]]" icon="fa-clipboard-question" text="investor questions"%]

-----------------------------------------------
popup-structure snippet
-----------------------------------------------
<a %handler% href="%url%"?[%snippet:query:empty-query%]"><button class="uk-button uk-button-primary"><i class="fa %icon%"></i>&nbsp;&nbsp;%text%</button></a>

-----------------------------------------------
popup-onclick
-----------------------------------------------
onClick="openPopup(this.href); return false;"


Does this look wrong?
Peter van Westen's Avatar Peter van Westen ADMIN
What result are you getting?

This doesn't look right:
href="%url%"?[%snippet:query:empty-query%]"
Should probably be:
href="%url%?[%snippet:query:empty-query%]"
Please post a rating at the Joomla! Extensions Directory
Jonathan Asbell's Avatar Jonathan Asbell
Not working. See the purple button displaying with %text%

realplaces.io/services/direct-to-buyer-no-agent

relevant pages and snippets
---------------------------
PAGE
Sell Directly To A Buyer Without Salespeople

SNIPPETS
button-tools-seller-investor-questions
popup-structure
popup-onclick


Confidential information:
(hidden)
Peter van Westen's Avatar Peter van Westen ADMIN
You haven't created any variables in the snippet 'popup-structure'.
Please read the documentation on variables:
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. So here is a question:
If I am using a %myvariable% in a snippet there would be no purpose in having that UNLESS THERE ALSO was a declared variable "myvariable"
....AND....
if I declared variable "myvariable" in a snippet it would have no purpose without %myvariable% in the snippet

So if they cant live without each other than its just acting as a "second check". If that is true then why dont you scan the snippet on save and pop up a warning if one exists wthout the other? Or better yet, dont hide th variable on another tab (out of sight out of mind). Put the variables on the main tab with the snippet content, create the vaiables, then allow us to click them so that they are inserted into the snippet with the %myvariable% format, just like email and text templates we use.
Peter van Westen's Avatar Peter van Westen ADMIN
Some of the reasons to have the variables tab in which you need to specifically tell the snippet which variables it can use are these:

- There are no longer potential conflicts with other extensions you might want use inside the snippet that use the same plugin tag syntax as the variables.
- Also no longer conflicts with other texts that contain content that could mistakenly be interpreted as snippet variables (like math based content, like formulas).
- The editor button now knows which variables there can be and which in needs to pre-fill in the tag (if you select that in the snippet).
- It is much more clear what default values a variable has, using that variables tab.
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