How to create a submenu in Joomla! frontend - php

What I'm trying to do is create a submenu (in Joomla! backend) with below code but it does not work.
JSubMenuHelper::addEntry(JText::_('test'), 'index.php?option=com_test&controller=test', $controller == 'testcon');
I have attacted a sample pictures here. It explains what type of menu I want.
sample menu is here. check this picture
Thanks!

JSubMenuHelper is designed to be used in the Joomla! Administrator section, it's not made for the frontend.
If you really want to get to it, you need to include the file:
/administrator/includes/toolbar.php
Also you will have a bunch of missing CSS (js maybe also) files that you also need to include (form the admin template folder)
But I see no reasons what you want to use JSubMenuHelper in front-end. I would strongly advise against using it.

You should create menu and (submenu) in Admin Panel, but I think you already know that :)
Later you add look and feel with CSS.
I think you should do ti with CSS not PHP.

Related

edit magento navigation without coding

I just recently started working with a Magento site, and so far I'm really not liking it. I need to remove a couple links from the main navigation, but I can't seem to find the option for it. I've googled it numerous times, and all I see are examples for coding the navigation. My question is, can you edit the site navigation like you can with say wordpress? Seeing how it's a cms I'd imagine the user should be able to make changes to the navigation using some type of interface, and without having to pull the files from the server and edit them.
Also just out of curiosity, for anyone experienced with Magento would you say it's a good choice for a cms? I've heard of it before, but haven't seen many sites that use it.
No!, so you have three options here.
Learn how to extend the navigation with the 100's of tutorials out there, it is really not that hard, assuming you have a theme you just have to edit app/design/frontend/[theme]/default/template/page/html/topmenu.phtml
Get an extension to do it for you.
Hire a developer to do it for you, we create a static block with installer for the html which make it slightly more user friendly to update in the future.
Stackoverflow is a bad place to ask questions like this, it is aimed at programmers and doing such a procedure is rudimentary stuff, I really hope you are a client trying to be cheap rather than someone who claims they can run this site.
Edit: The cms features are ok but you need to be able to code to set them all up so the end user can make the changes with WYSIWYG.
If you don't want to code for navigation then you can do below things
1) Create category and then Display Settings=>Display Mode=>static block only and Display Settings=>CMS Block=>static block name. In static block u can include in page url or custom page
2)You need to hire developer
If you're using Magento and have an integrated WordPress blog, it's possible to design a completely custom menu in the WordPress Admin using the menu builder. You have complete control over what menu items you want and the hierarchy of each item.
To get this to work, you need to integrate your WordPress blog using WordPress Integration in full integration mode. Your Magento template also has to be using the default Topmenu block.

URLs for Joomla Component

I have created a simple basic component in joomla named, careerform so I want to know that what will be its url? Will it be :
index.php/?option=com_careerform
or in sef it will be something like:
index.php/components/careerform
or it will be like this while using .htaccess
/careerform
Is it true or what are joomla default URLs with different settings? Please tell what you know.
thanks for your time.
While what you are asking to do is possible, it would be rather complicated to rename a component. As part of the renaming you would have to update the names of dozens if not hundreds of classes throughout every file of the component. Very likely to run into some bugs because of this.
The far easier prospect is to just avoid these types of urls in your site. Joomla will only fall back to that style of url if a menu item does not exist for the view. Because of that, you can make the url into this:
http://sitename.com/any-component-alias/
To do this, go into the menu manager and create a new menu item. If you don't want this as part of the main menu, you can create a new menu. (I typically have a menu called "Hidden" for menu items that I want aliased but don't actually link to throughout the site from a menu.) When creating the menu item, make sure the type matches the component and view. The alias will then be whatever is entered in the alias box just below the title.
The one issue you may run into with this is that a component may not have a menu type for a particular view. In that case, you you would need to add the necessary metadata.xml file to the view (which again would be much easier than renaming the component!). A good tutorial for that can be found here: http://docs.joomla.org/Adding_view_layout_configuration_parameters.
yes if SEF will be enabled then index.php/component/careerform will be used.
You can create custom URLs by developing a router for your component.
There is very good documentation for it here.

Joomla custom Template Override not working

I want to use a template override for Articles in Joomla, therefore I am using
mytemplate/html/com_content/article/default.php
If I change anything in this file the changes do appear.
But as I want to use an extra .php-file f.e.
mytemplate/html/com_content/article/alternativeLayout.php
I am facing a problem. Because although I can select this layout on the article settings page - any Changes I make do not appear and still the default.php is used.
Any ideas what I am doing wrong?
In order for an alternative layout to be used, two conditions must be met -
You must select the layout in the article parameters
No menu item can exist for this item - the layout selection of the menu item will override the selection in the article parameters
It sounds like your problem is with #2.
EDIT
Duh, I missed the key part of using alternate layouts. In order to be able to use an alternate layout with a menu item, you have to create an alternatelayout.xml file and place it in the override folder. This will give you an additional menu item option that you select when creating your menu item. You should be able to copy the defailt.xml file and edit it for the new layout.
I created a visual tutorial for this as it was driving me mad for about two days until I figured out how to actually work it. You can find it here: Joomla custom article template
I hope it helps others solve this faster than I did :-)
PS: all the credit for the article goes to Brent!!
the name of the files must be the same. The override must have the name "default". So its:
/yourTemplate/html/com_content/article/default.php
/yourTemplate/html/com_content/article/default.xml
/yourTemplate/html/com_content/article/default_links.php
had exactly the same problem, this solution solved it.
Also, note that any override filenames must be lower case. For example, "AboutPage.php" won't work.

Using Symfony, sfDoctrineGuardPlugin plugin, How can i customise sf_content? Using partials?

I am using symfony 1.4.8 with sfDoctrineGuardPlugin for my backend.
My question is how can i customise sfDoctrineGuardPlugin's default content? For example, how can i do something on the page between filter and table (on the left hand site)? Or, how can i customize table (http://goo.gl/ZmRey)?
I cannot find any solution for using partials on backend. Is there any way to use partials/components/slots on backend?
I hope you understand my question and tell me a way.
Thanks for your answer(s),
Erman
Partials, components and slots are no different on the back-end to the front-end - your "backend" is just another Symfony application. From the screenshot you gave, it looks like you're looking to customise the admin generator theme.
The quickest way to get started with this is to look in your cache/appname/ folder and see the automatically-generated modules here, with all the template files, partial files and so on. You can then create an empty module in your application, and override select parts of the theme with whatever you want to change. See this part of the Symfony docs for a full list of partials etc, and how to go about overriding them in more detail.
In the specific case of sfDoctrineGuardPlugin-module pages, these can be overrided in the same way as normal modules - simply create eg an sfGuardAuth module and override the selected parts of the module you want to.
If you want to go further and create your own admin generator theme, this is a bit more advanced. Here I will shamelessly promote a blog post I wrote last year ;-) John Cleveley's presentation also provides some great tips.

Zen Cart Custom Template Problem

I have been asked to upload a Zen Cart site to my servers and have done so fine.
I am getting a problem now with the fact that the client has uploaded his custom template into the includes/templates folder and selected it in the admin - but it still wont load it. instead it just loads the template_default style.
I am been through every document I can find and have performed the 'reset' of the Layout Boxes Controller, but nothing seems to resolve it.
Can anyone tell me if there's a file I need to tweak or something to make sure it loads my custom style?
Cheers,
C.
One solution would be to overwrite the default theme with yours. I know this is not what you are asking, however, it would solve your issue.
Zen Cart templates can be really simple or really complex. So installing them can be easy or complicated. The files are probably in the wrong place, or not completely installed. It's easy to make a mistake. Just in case, here's the outline:
1a. Simple - Copy the cart template files to includes/templates/your_template_name/.
or
1b. complex - Copy the cart template folders to includes/.
2 Go to Admin > Tools > Template Selection and click Edit.
Select your_template_name. (If you don't see your_template_name something has gone wrong.)
3 Many templates install with the sideboxes turned off. Go to Admin > Tools > Layout Boxes Controller and edit the sideboxes to turn them on.
One idea for trouble-shooting ...
Look at the database template_select table. What template_dir is set?
If this is happening, double check the file includes/templates/YOUR_TEMPLATE/template_info.php. This file is used by the system to determine if a folder under includes/templates is actually a template, and things won't work without this file. Once you've set this file up, go back to admin->tools->template selection and try re-selecting your custom template.

Categories