Joomla - Custom component url rewrite - .htaccess

I have the following component #
?option=com_tmportal&module=user&task=main
I've enabled url rewriting and setup the htaccess file which is all working correctly, how would I create a rewrite rule that allows me to access the component above by simply doing:
/portal/ = ?option=com_tmportal
or
/portal/user = ?option=com_tmportal&module=user
or
/portal/user/main = ?option=com_tmportal&module=user&task=main
Thanks for any help, much appreciated :)

You haven't specified Joomla version so I'm assuming 1.6/7/2.5 in my answer.
Short Answer: If you're using Joomla!'s default .htaccess then all you have to do is create a Joomla! menu to each of your components views with the right alias eg. portal for your default component access ie. ?option=com_tmportal.
This is what the default .htaccess does it passes all of the elements after the base URL to index.php to help select the component and view.
Longer Answer
When you create a component for Joomla! you specify the menu settings for each view using an XML file usual the same name as the view file in it's view/tmpl/ directory.
Typically the url to a specific view & task in a component would look like these:
?option=com_mycomponent
?option=com_mycomponent&view=userdetails
?option=com_mycomponent&view=userdetails&task=main
Joomla!'s framework will automatically use the view & task params to get your components correct controller and view (or sub-view). I'm not sure that it does anything with the module param that you have in your URL's so I'd guess you're trapping and processing that yourself.

Related

Custom search result page in shopware5

I need to create a custom search result page for my Shopware site. As I know custom pages can be designed only for detail and list pages.
However, after creating custom list page for my site with the name of “custom_listing.tpl” my search result page is still looks like the default list page of the site. How can I get rid of this default list page template on my search result page?
I tried to change the fuzzy.tpl {include file='frontend/listing/listing.tpl'} to my “custom_listing.tpl” but that did not work.
What you need to do is to create your own theme/template and activate it in the Shopware backend. Further you need to create your own frontend/search/fuzzy.tpl in your theme folder.
Now let your own fuzzy.tpl extend from the original one like so:
{extends file='parent:frontend/search/fuzzy.tpl'}
After that you will have access to all the smarty blocks that are defined in the parent fuzzy file and even in the frontend/index/index.tpl of which the parent fuzzy extends from.
Make your changes, deploy it to your localhost or webserver and after clearing the cache the search controller should autoload the overridden fuzzy.tpl with your custom search results layout.

Custom information pages not using SEO friendly URLs in OpenCart

I am having issues with the opencart layout override feature. I have created a new information page and I set the layout override to "test". The route for this layout is "information/test". The controller is in the right place, as is the template. I gave the new page the seo-friendly url of "test-page".
My issue is that if I type in "domain.com/test-page" it will get there, but it uses the regular information layout instead of my customized test layout. I can type in domain.com/index.php?route=information/test&information_id=119 and it will now show the page with the right layout.
Is there a way to have it go the customized layout page (domain.com/index.php?route=information/test&information_id=119) when I type in the seo-frindly URL that I created when I created the new information page.
My issue is I am trying to add a carousel to just one information page, while still using seo-friendly URLs.
actually what you coded in template file test.tpl is not a layout, its actually a page accessed using test.php controller , and that page can be opened by accessing url domain.com/index.php?route=information/test&information_id=119 as you already mentioned.
How to create layout then ?
You have already created layout named test by going to System >> Design >> Layouts, now go to module carousel and a module to test layout at say content-top , set your test-page layout override to test and now go to domain.com/test-page and you will see carousel at the top, this is how layout works. what you previously doing was creating a new page by duplicating information controller and template.
A similar discussion on opencart forum Here

How to remove bits from the url using the htaccess file?

Hi I am using joomla for my website and I would like to remove the bits in between my url.
The original URL:
"/calums/index.php/component/jsjobs/jsjobs/employer/"
The way I want it to be:
"/calums/employer/"
It would be great if some one can help me work out how to do it using the htaccess file.
Thanks.
first of all you need to enable SEF in Joomla to get rid of the /index.php/ part:
enable sef in global configuration (the first two checkboxes)
copy your htaccess.txt to .htaccess
This is transparent and should make your URL look like this:
/calums/component/jsjobs/jsjobs/employer/
Then, by looking at your URL, it appears the component jsjobs doesn't have a menu item associated. Menu items are associated with views, so you should go into menu manager and add a new menu item and try to setup menu items for jsjobs. You might not find one that matches exactly but you should be partway there.
Once a menu item is setup (and the cache is cleared) you should begin to see
/component/jsjobs replaced at a minimum. If there is no menu item that produces the right url, then you might have to create an .xml file in the component/view folder you desire. More details in this answer: Joomla Developement :: Probleme with URL Rewriting
my first answer on stackoverflow. try this:
RewriteEngine on
RewriteRule ^(\w)/(\w)/(.*) $1/index.php/component/jsjobs/jsjobs/$2/$3

Problem with custom registration fields in an multistore setup in magento

I have 2 sites running on my magento platform.
For site2, I added new fields to the registration page and it works properly.
Now, I noticed that when I try to register in site1, on submit I am shown a validation message that the additional fields I have added for site2 are required.
How do I make sure that the additional fields added for site2, are asked only for site2 and not site1?
I have separate themes for both site1 and site2 and both of them have separate register.phtml files.
In the config.xml file for adding custom registration fields, I have this added:
<customer_account>
<employee_id>
<create>1</create>
<update>1</update>
</employee_id>
<doj>
<create>1</create>
<update>1</update>
</doj>
<mobile_number>
<create>1</create>
<update>1</update>
</mobile_number>
<alternate_mail>
<create>1</create>
<update>1</update>
</alternate_mail>
</customer_account>
which is under <global> tag. I assume Magento is reading this. How do I make sure magento reads this config file for a particular site/store? Thanks.
If you want to see the entire XML tree magento has compiled from all XML configuration files:
header("Content-Type: text/xml");
die(Mage::app()->getConfig()->getNode()->asXML());
Will present you with a single compiled XML of their entire tree, this may help in determining if your changes are being added.
Also be sure and checkout Alan Storms CommerceBug as it has this functionality built-in.
How I solved a similar situation is that I added system configuration options to allow me to set which custom field is enabled all the way down to the store view scope. This means I don't need to have separate phtml for the different stores, but can just use the same.
I've also created custom phtml 'widgets' - modelled on the Magento DOB, Gender and Name widgets. The custom widget block code has a 'isEnabled()' method that checks the config flag. In, say, my checkout/onepage/billing.phtml I can say:
<?php $_mywidget = $this->getLayout()->createBlock('mycompany/customer_widget_mywidget') ?>
<?php if ($_mywidget->isEnabled()): ?>
....
<?php endif ?>
Hope this helps.

Need to have separate "complete" Drupal theme for each page on a site

I want to build a Drupal demonstration site where I can create several custom themes and display each on a separate page of the site. Access can be either via links or menu items. The "simpler" the solution the better.
Create a custom block that executes PHP code. The following code snippet should show the current page in the theme set in $custom_theme.
global $custom_theme, $theme;
// If $theme is set, init_theme() will not initialize the custom theme.
unset($theme);
// Set the theme you want to use.
$custom_theme = "garland";
init_theme();
There is also a module that allows you to change the used theme based on some rules (in example, the content type being showed, the URL of the page being viewed, etc): the project page is http://drupal.org/project/themekey.

Resources