Jump to content

Module: TemplateHasTags


MichaMichaMicha
 Share

Recommended Posts

Module: TemplateHasTags

Simple Module that provides a method for checking if the current template has got (or has not got) one or more specific template tags.

Wanted to control the visibility for some blocks on the frontend in the backend without modifying the code. This seemed to be the best way.

Returns true if the currently used template:


--
has the tag "detail" but not "special"
$page->hasTags("detail !special");

--
does not have the tag "listview"
$page->hasTags("!listview");


You can also use $page->hasTag("lorem ipsum");

Module link

  • Like 6
Link to comment
Share on other sites

I don't understand this =)

Can you present a use case more specifically? When talking about "template tags" do you mean regular html tags?

Check out the Advanced tab in a template detail view. There is a field called tags. You can use it to group templates in the Templates List.

I used to use a regex each time to check for the presence (or absence) of a tag, but now I have this Module so it's more solid.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...