In a custom Joomla! template, how can I determine whether I am on the home page? - joomla

I am trying to create a custom template, but I want the template to look a little different for my Joomla! homepage/frontpage. Is there a easy boolean-type expression I can use to determine whether I am on my site's homepage?
That way, I can just say if ($on_homepage) { [custom homepage html] } else { [regular template] }
Thanks in advance!

You can create a separate template for your homepage. More details here.

This is very easy, just create 2 templates. One for your homepage and one for the rest of your site. Then install both, make sure you give them a descriptive name in their xml file so you know the difference.
Once they are installed you can set a default template that would be site wide. Then choose/click on your homepage template and it's options will load up. On the bottom left you can select the menu items where this template will be visible. This setup is very much like the way in which you define where modules are shown.

Related

How do I get Magento 2 data to use in the template?

I am starting in the Magento development world, and I'm creating a new theme.
On my theme, I have a block which displays business contact info, but I don't know how to get the data from the store.
I have to make a custom menu as well, but stop in the same problem: getting category data from the store.
I also wanted to know if there is any place where you can find more references on this data return issue, such as what available methods and classes are available, for example.
Where do you want to display the custom data ? In a product page or your custom module's separate page ?
If you want to use custom block in sidebar you can follow steps given here
https://aureatelabs.com/magento-2/how-to-add-a-static-block-in-a-sidebar-column-magento-2/.
Here are some ref you can use:
https://itectec.com/magento/magento-magento-2-get-custom-module-data-in-theme-phtml/
https://code.vky.co.in/display-custom-module-collection-data-frontend-magento-2/

How do I create a custom page in Joomla 1.5

I have a website here that I need to create a custom page where in I can call the header and the footer as well as the sidebar.
If you're going to do it in Wordpress its easy as this link says:
https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/
However, Joomla is a bit different on this one. If I will try to add a new article I wont be able to customize the layout that I want. Let's say in the custom page I want to create I don't want the footer to show up and I want to add internal CSS on it which is possible on Wordpress custom page.
Any idea how do the same thing Joomla 1.5??
Thanks!

Different .phtml to diffrent type of product

I am trying to make module that switches diffrent .phtml of productview depend on attributeset name. I dont know witch file is responsible for rendering productview.
It is usually Magento Block that render template. In your case productivew is rendered by
Mage_Catalog_Block_Product_View.
You can easily figure this out by enabling template_hints and template_hints_blocks. To enable these to option follow steps below:
Go go Admin
System > Configuration
In left column, Select Developer under Advance.
Change Current Configuration Scope to website level (template_hints and template_hints_blocks is applicable at website level only)
Make yes to Template Path Hints and Add Block Names to Hints under Debug group.
you can rewrite this class:
Mage_Catalog_Block_Product_View
and then you can add your own logic to it to switch to another template, not the standard
catalog/product/view.phtml

Magento Multi Store themes calling same login.phtml file

I'm new to magento. Currently i'm developing two ecommerce sites using multi-store option in magento. Both the sites are 90% over, last night when i planned to customize the login page i was shocked. The reason is the changes made in first store login page also reflecting in second store also. The login page is curently calling from
frontend/default/default/template/persistent/customer/form/login.phtml
Is it possible to give any custom login page? PLz guide me magento experts......
Please update your post with your frontend/ folder structure down to each theme template folder. It might be that you don't have a copy of login.phtml in the second theme. Moreover you should follow templates best practices as:
Always create for a new shop different packaga. So not
frontend/default
but
frontend/yourcustompackage
Always have default theme left as much untouched, as possible. So in the
frontend/package/default
Should be some basic changes and rules of your package. It means for example in the putting reset.css for all of your themes. Or something like this.
As for me, each store view should have own theme. So, for example, storeview1
frontend/package/storeview1/
There you copy and change files specific for this theme. So, for example, in default you might have login.phtml. But you want storeview1 to have another login.phtml and in storeview2 it should be the same as in default. Therefore you copy the login.phtml from default to storeview1 and change it there. Don't forget to change package and theme in System->Configuration->Design. Package should be change for whole shop and theme should be specified for every store view or left untouched for default.
P.S. Magento theme fallbacks
P.P.S. Try this tutorial or google another one
P.P.P.S. I hope, you got the answer for your question.

How can i override the default magento cms homepage entry with a custom module?

I am currently attempting to use a custom module as the first page when you hit the magento installation, i currently have {{block type="namespace_module/block" template"path/to/template.phtml"}} located within the home page cms entry, but unfortunately it is not calling the template or the module which i am requesting, i am now looking at trying to find out if its possible to use a custom module (controlled by indexController.php) to take precidence over the cms home page entry.
This has two reasons behind it, reason 1, it will give me more flexibility for me to extend the index page, and 2, it will allow me more flexibility over css/js which i want to include on that specific page.
If anyone knows of a solution to getting a custom module to take precidence over the cms home page it would be a huge help to myself and the community at large as many people are un-aware of how this is achieved.
Thanks for any assistance provided.
Ryan
If you have a custom controller then put it's frontname/controller/action path in System > Configuration > Web > Default Pages > Default Web URL.

Resources