Is there a "switch" tag available - twig

I just tried to use the switch tag on a twig template, on a Symfony 5 project and got an error.
Then looked for a solution on the web, found documentation, double checked my syntax, that was correct.
Finally, searched the twig vendor folders and didnt' found any switch*.php file.
I guess this is not available by default but can't believe it. Does anyone have an idea?

No, swicth not exists in default Twig installation.
To use the switch statement you must implement it by yourself or use a bundle/package like buzzingpixel/twig-switch.

Related

Include statement in pug/jade

I want to use a variable provided from my CMS to reference an include template like this:
extends layout
include layouts/#{data[0].fields.layout}.pug
This just looks for layouts/#{data[0].fields.layout}.pug rather than what I wan, e.g. main.pug. Is there a way to do this?
Unfortunately, this is not possible at the moment. Dynamic includes are currently not supported by Pug (see this SO answer and this Github issue).

How to solve Gitbook don't work?

When i use gitbook,the Table of Contents are as blows:
How to resolve it? There is a remind:Need valid "ref" options
It seems like you don't have a SUMMARY.md. At least I don't see one in your files Tree.
If it still doesn't work, do you have a link to your files?

Movable Type: Is there a way to display revision number?

Is there any way to display how many revision has made to a entry?
I don't see this template tag in the tag reference.
I know there is current_revision API tag, but how do I
display this in template?
There's no core template-level access to revision information at the moment. I don't think anyone's put together a plugin to do it yet, either.
This is entirely speculative(read: I haven't done it), but you might be able to extract this with the Object plugin, if you can figure out the templating required. That plugin is basically an MTML-based way of rummaging around the database without being restricted by what the pre-defined template tags let you do.

Drupal search - alternative ways of doing it?

3rd Drupal question in a day.. guess what I'm doing!
OK, I've got the default Drupal search block, but I really need to find a way of restricting it to just searching one particular content type which is called "recipes" (guess what that one contains!)
Does anyone have any ideas on how I can restrict the search and then go about controlling the output display?
Thanks!
You can use the Search config module. If this module does not your work you should also look at this page: http://www.drupalmodules.com. Just type in "search" and you can find a few search plugins with descriptions.
I recommend the Finder module, which works well with CCK and filters and is straightforward to theme.
You could be interested in trying Faceted Search, which add a series of blocs to filter the results returned by the search module. There are many other modules which are related (see Projects related with Faceted Search).

Bug template in Bugzilla

Is there any way to enforce a template in Bugzilla to guide users fill in bugs descriptions ?
Actually, i'd like to put some markup texts in the bug description field and avoid the creation of custom fields.
I've installed version 3.2rc1.
Indeed, just check ../enter_bug.cgi?format=guided , which forms an example of the template feature. Half the work is already done for you.
The mechansism described under 6.2.5 Particular Templates (under the section called bug/create/create.html.tmpl and bug/create/comment.txt.tmpl) works pretty well for us. Even though you say you don't want to create custom fields, adding some arbitrary HTML is easy enough.

Resources