How to add helper to view helpers? - view

As in title: How to add helper to view helpers? so I can use it without loading custom helpers group?

You can use the settings.yml to auto load helpers. Don't forget to add the default ones (Partial, Cache) too or they won't be loaded.
For example:
all:
.settings:
standard_helpers: [Partial, Cache, MyCustomHelper]
http://www.symfonyreference.com/ is a good site for symfony configuration reference.

Quoting the "gentle introduction" to Symfony 1.4
The list of the standard helpers, loaded by default for every
template, is configurable in the settings.yml file.
It will avoid to call use_helper() on all of your templates (if I have correctly understood your question).

Related

Laravel Twig - Add a Macro

Currently, I'm switching a few of my blade templates to Twig in my Laravel project and I had a macro I was using that extended the HTML helper. This is how it appears in my directory:
app
Bunny
Controllers
Facades
Macros
HTML.php
Models
Views
etc...
In my HTML.php file, I have this:
HTML::macro('npc_messages', function($messages) {
// all my logic is in here
});
I have a few other ones as well. I want to know how to make my Twig templates register that macro so I can just use html_npc_messages( var ); like I can with their html_image, etc. Thank you for any assistance!
I checked out the documentation on the github URL: https://github.com/rcrowe/TwigBridge
But I'm not fully understanding what they are doing there under the "Extensions" section.

Create custom module, with javascript and load javascript into footer

I have been assigned to create joomla template from HTML template, and this is first time for me. In HTML template I have a custom JS, and as far I can tell, I will need to create one, or maybe two custom modules in order to recreate functionality that exists. Is there some way to write JS for specific module and load it in footer (this module will be active only on one page, so I don't want to load JS on all pages). Is it possible to do this, or the simplest way is to load JS on everypage?
Please read the Joomla documentation on creating modules Creating a simple module and then on your module file mod_mymodule.php add the script call using:
$doc = JFactory::getDocument();
$doc->addScript( JUri::root() . "media/your_js_directory/your_script.js" );
Hope it helps.

Joomla 3: Advanced Options for modules not working

In Module Manager, when I go to the module settings, in the second tab called "Options" there is "Advanced Options" section. Inside Advanced Options, there are some fields such as Module Tag, Header Tag and Header Class. When I update these fields, I cannot see any update in the module's html. Do I need to call these functions in the module template using code something like this $params->get('header_class')? I thought this would work without having to make changes to the template code. Just wanted to clarify.
I believe you should reference those items via $params such as $params->get('header_tag', 'h2') in the module chrome. If the module chrome does not make use of that parameter(s), then you won't see any change. You can create an override in your template /html/modules.php to use them.

PyroCMS Custom Module Layout

I created a custom module called Drawings. I wanted to give it its own theme layout on the frontend, so I followed the advice I found HERE - I put a layout file titled Drawings.html in my theme.
This had the correct effect on the frontend, but caused other problems and questions that I've been struggling to sort out:
The backend admin section for my module now uses the Drawings.html layout, which breaks its functionality completely. How can I set a specific layout for my module front end, but keep the standard admin backend layout (same backend implementation as in the sample module tutorial)?
I read the following in the Template Library: "When using Public_Controller and Admin_Controller, the layout is already set." Perhaps the solution involves using the set_layout function in these controllers somehow? All my attempts failed so far though.
I feel I am doing something incorrectly because now my module is not modular. For example, after creating the Drawings.html layout file in the theme, a statement like {{ theme:css file="drawings.css"}} in that layout file searches for those resources in my theme. So I have to put those JS and CSS resources in my theme, instead of in my module's CSS and JS folders. How do I keep and access my resources in the module's JS and CSS folders?
I don't know how this is supposed to work.
When you are using front end controller use a layout there using philsturgeon template library like this
function index(){
$this->template->set_layout('drawing')
->build('yourview');
}
This way you can load a custom layout for your application.

Multistore, template code from code/local/

I'm prepare a multistore on magento.
I have a three template, and I was change a few file from code/core and replace in code/local, but only one template take a changing code from code/local
a rest template should take file from code/core/
Now every template take files from code/local/
How can I'm set app to resolve a problem
thx for help
You should NOT overwrite core files in local. Better try to develop your own module which rewrites the core functionality. In this module you can integrate a configuration, so it's only used for one store view, and not for all.

Resources