How would I create a RouteModule in Angular 2 without forRoot - angular2-routing

I am working on going through the Style guide for Angular 2 and I happened upon this line
Do end the filename of a RoutingModule with -routing.module.ts.
I haven't had luck finding anything on routing module examples so I went to Papa's blog. There I found this line...
The forRoot() function should only be used for creating the root modules' routes. When we get to child modules and routes, we'll use other techniques that we'll see in later posts.
So how do I create a RouteModule that isn't using forRoot like suggested.

I think I found an example here...
https://github.com/angular/angular.io/blob/master/public/docs/_examples/ngmodule/ts/app/contact/contact-routing.module.ts

Related

Layouts inside folders Nuxt js 3

Layouts inside "layouts" folder work as expected but when I try to save a layout inside a folder like "layouts/mobile/custom.vue" does not seem to work.
just throws this message as if the layout does not exists.
Invalid layout `mobile/custom` selected.
when I try to use it inside "pages/index.vue" like this.
<NuxtLayout name="mobile/custom">
some code ...
</NuxtLayout>
This works for "layouts/custom.vue" inside "pages/index.vue".
<NuxtLayout name="custom">
some code ...
</NuxtLayout>
I know that Nuxt 2 added support for this after an issue, but I'm not familiarized with it as it has 1 failing check but at least says "merged".
Adds support for folders in /layouts #1865
I tried to search any type of information about it but not even the documentation of Nuxt 3 itself says something related to this. Nuxt 3 Issues no luck.
Nuxt 3 - Layouts
Does anybody knows why this happens ? or is it that this feature is not supported yet in Nuxt 3.0.0 rc4.
I tried on a clean Nuxt 3 installation.
This feature was added in Nuxt 2 long ago.
Adds support for folders in /layouts #1865
Nuxt.js does not respect layouts in separate folders. #1854
It does not seem to work the same way in nuxt 3.
update...
I checked the source code for Nuxt 3 and definitely is not supported.
example: layouts/folder/custom.vue
and then use it in pages like follows
<NuxtLayout name="folder/custom">some code ...</NuxtLayout>
I just sent a PR for this feature.
Adds support for folders in /layouts #5796
Hopefully it gets accepted or at least it gives someone the idea to add this.

Mageno module idea

I'm working on Magento modules.
After few guides I managed to create module that says "hellow world".
Also I have made some of css code that add simple image border around whole page.
So the problem is: how to combine them together?
I want that when I install my module, image border appears around page.
What should I be looking for? Any tips? I need right path to look for answers
T.y.
You need to to
Create a module
That modifies the global layout such that your CSS is added to the page
Re: number two, there's multiple ways to go about doing this. These days I favor the event/observer method
Add an observer for the controller_action_layout_generate_blocks_after event
Fetch the head block from the layout in your observer method
If you find a head block, add your CSS file to it programtically
The more traditional way is
Configure you module to include an additional layout update XML file
In the default handle of your new layout update XML file, add XML that tells Magento to add your CSS file
That should give you enough to google on and come back with more specific questions. Good luck!

Prestashop 1.5 - cannot over ride top menu css

I am new to Presta Shop and trying to create a custom theme. I have read about the documented way to do this by extending the current module css/template files where necessary here: http://doc.prestashop.com/display/PS15/Overriding+default+behaviors
It all seems straight forward. I have over rode the templates and CSS for 2 modules so far with ease but on my 3rd attempt I am encountering some issues. I attempted to over ride the following CSS file:
/modules/blocktopmenu/css/superfish-modified.css
with this
/themes/newtheme/css/blocktopmenu/superfish-modified.css
but it did not work. Out of interest I also tried overwriting with this path too:
/themes/newtheme/css/blocktopmenu/blocktopmenu.css
but that also did not work?
Hopefully someone out there can help or shed some light as to the reason for this or a solution?
Thanks, Matt
Actually I just figured out the issue, the superfish-modified.css is in its own css folder in the actually module so the correct path to over ride should be:
/themes/newtheme/css/blocktopmenu/css/superfish-modified.css
10 points to me.
Is there a missing "modules" in that path? Is it not…
/themes/newtheme/css/modules/blocktopmenu/css/superfish-modified.css
to me, should be
/themes/newtheme/modules/blocktopmenu/css/superfish-modified.css
and you must copy blocktopmenu from /modules to /themes/newtheme/modules/
Seems to be an issue related to this module. Here the solution

Template files not being discovered

I was experiencing an odd problem where blocks were not showing up on a site. After a lot of spelunking I have found that block.tpl.php is not getting called/discovered.
Looking at the suggestions that the theme engine is trying to find it looks like the most general template it will look for is block-MODULE.tpl.php - ie if I set up symlinks for block-block.tpl.php, block-views.tpl.php etc then the content will show.
It just won't find block.tpl.php
So I can kind of make the problem go away, but I'd feel a lot better if I could fix it properly.
Anyone know why (or where) this would happen?
This is drupal 6, with a zen subtheme. zen is in sites/all/themes/ the subtheme is in sites/example.com/themes/.
(it does seem to be finding page.tpl)
PHPTemplate will find the more general templates (e.g. block.tpl.php): you can confirm this behavior by looking in the themes/garland folder which has its own block.tpl.php.
The most common reason for the template engine ignoring your template overrides is because the theme registry has not been reset. You can reset it by going to Site Configuration -> Performance and clicking Clear cached data at the bottom of the page.
Also make sure you've gone through and followed the instructions for sub-theming exactly: missing a step can produce unexpected results:
How to build your own sub-theme (6.x-2.x)
How to build your own sub-theme (6.x-1.x)
Turns out I had added a to the hook_theme() function in template.php for blocks that was pointing to a different location and confusing everyone.
Why I did that is lost to history, but it seems to server no useful purpose.
there should be a version of block.tpl.php in both the theme and subtheme directories.

How does one inject variables into page templates from a custom Drupal module?

We've created a custom module for organizing and publishing our newsletter content.
The issue I'm running into now -- and I'm new to theming and Drupal module development, so it could just be a knowledge issue as opposed to a Drupal issue -- is how to get each newsletter themed.
At this point the URL structure of our newsletter will be:
/newsletters/{newsletter-name}/{edition-name}/{issue-date} which means that we can create template files in our theme using filenames like page-newsletters-{newsletter-name}-{edition-name}.tpl.php, which is great. The one issue I'm running into is that all of the content comes through in the $content variable of the theme. I'd like to have it come through as different variables (so that I can, inside the theme, place certain content in certain areas.)
Is there a proper way for doing this?
Edit: To answer some questions: The issue is a node (there are issue, edition and newsletter nodes) and the path is being set using hook_menu with wildcards and a router.
The best answer I could find was to add a check inside of phptemplate_preprocess_page to send the vars back to the module and have them be updated.
Like so:
function phptemplate_preprocess_page(&$vars) {
if (module_exists('test_module')) {
_test_module_injector($vars);
}
}
then in my test_module.module file I created this function:
function _test_module_injector(&$vars) {
$vars[] = call_to_other_functions_to_load_vars();
}
It seemed to work. I wish there was a way to do this without having to touch the theme's template.php file, but otherwise this works well.
If there were better documentation for template preprocess functions, Drupal would be a lot more accessible - as it is, you need to piece together the information from a lot of different explanations. One place to start is here:
http://drupal.org/node/223430
but if you take the time to work through the tutorial below, you'll find you can do most things:
http://11heavens.com/theming-the-contact-form-in-Drupal-6
This is an old post, and the OP's issues seems to have been solved.
However, just for others finding this through Google (or otherwise):
Install the 'Devel' module: http://drupal.org/project/devel
Also the 'Devel Themer' module: http://drupal.org/project/devel_themer
Use Devel Themer to go through the $content variable and find what you need to pull out.
There are a bunch of Devel/Themer docs/tuts out there, but its usage is pretty straightforward. Note, though, that some stuff in there will need to be sanitized before printing in the theme.
The suggestion to show the node as a View and then modifying the view templates sounds pretty crazy, though it'll work.

Resources