I have a menu in joomla that appears on all pages. Some of the items in the menu should be the same on every page, while others need to be dynamically updated based on the page the user is on. I am trying to create an override for the "external url" menu item type (listed under system links), that would allow me to create a menu item parameter the user could populate. Then, I could use this parameter in the menu template to determine what needs to be added to that particular link.
I understand Joomla overrides for the most part, but I can not figure out where the xml file for these system link menu items is located. If my understanding is correct, overrides should be stored in templates > myTemplate > html > com_myComponent or mod_myModule. I would assume if I knew what component the system links fall under, I could create an override for the xml file. Is this correct or way off?
TL;DR: Where is the xml file for menu item type "external url"?
It seems there is no specific xml-files for the system links, as they are defined directly in
administrator/components/com_menus/views/menutypes/view.html.php
which means there is no xml-file to override. You can, however, override the view class MenusViewMenutypes, which is defined in the view.html.php-file. This is done by writing a system plugin loading a file containing the same class. The recipe is simply and beautifully described here.
Related
In the pages .tpl.php of my theme i can find several lines like
render($action_links)
displaying whole pages with a single command. Sometime i saw that the render argument is a block from my theme .info, but other times i see arguments i cannot identify that render default pages or elements of drupal.
How it works? And where i can find a list of default displayable pages?
In particular, i needed to display the content of the default drupal page "add content" in one of my pages, and i'm pretty sure i can do it using this render method, but i cannot find the correct argument.
EDIT: I found something like
drupal_render(node_add('NODE_TYPE'));
that seems to allow the display of a node add form, but what i need is the main add content page, containing the list of all the type of nodes that a user can add.
Are you new to Drupal? When I read your post, I'm almost sure that you have missed something with the Drupal's working. The variables you found in render() functions are "calculated" somewhere else in the code (in the modules part for the most).
You cannot find a list of constant variables to display them just like this.
I found this article about these mysterious variables that are rendered and I hope it will help: http://newsignature.com/articles/the-magic-behind-drupals-render-elements
If you just want to display the "add content" form somewhere on your site, just call its path (node/add).
EDIT AFTER CLARIFICATIONS:
First of all, you can set on which page you want the user lands after login. (I don't know why you're still talking about user profile template. Maybe I missed something again.)
But if I did understand what you're trying to achieve, I'll do that:
Create a menu (or simply use the "Navigation" menu that seems to be exactly what you need) with all the actions users can do. And I'll place this menu in the main content region. Do create a menu, go to Administration>Structure>Menus>Add menu. And add links like "node/add/article" or "node/add/news" or "node/add/page" or whatever your content-types are.
Place this menu in the region you want. If you want it to be like the main content of the page, place it in the main container. To do so, go to Administration>Structure>Blocks> Drag and drop your menu in the right region and Save.
Configure this block to appear only on the front page (the first page on user arrives after logged in) if you want so. To do so, in the Blocks administration page, click on "Configure" next to your block and check "show block on specific pages: Only the listed pages" and write down <front>
Create roles and permissions for your different sorts of users. That will automatically show them the links they are allowed to see. To set permissions, go to Administration>People>Permissions and check in the "Node" section which content-type each role can create.
I hope I didn't forget anything. Please tell me if it is clear enough.
I am new to php. I am trying to debug something in joomla based website.
the file path I want to go is something like
http://url/index.php/abcd/efgh/hijk?tmpl=component
I donno how to go forward with '/abcd/efgh/ijkl' . Because index.php is a file and there is no clue for /abcd/efgh/hijk
Joomla routes are based on the menu item alias which identifies the component, which is responsible for rendering the main page content. So if you know what you clicked on, find the very same menu item in the menu manager and you'll be able to inspect it. The url is built like this:
index.php/top-level-menu-alias/next-level-menu-alias/third-level/
If the component requires parameters, and the component's router.php is doing its job, you might find (at least some of ) the parameters appended:
index.php/top-level-menu-alias/next-level-menu-alias/third-level/some-component-params
So abcd is definitely the alias of a top level menu item. Open your menu manager, find it, then look for the next part and so on until you get to a "leaf" menu item. All extra data on the url will be the component params.
Once you know the component and the menu item, you can change the paramters from the menu item or look up the code. In order to find the code, just look for the real non-sef url in the menu item, it will look something like this:
index.php?option=com_content&view=article&id=116
com_content is the component, i.e. look for it under components/com_content.
article is the view name, it will be under the component's root/view/article and the actual markup in the subfolder tmpl.
&tmpl=component
tells Joomla to render the component using your template's component.php instead of index.php. This typically renders only the component and libraries, but no modules. Your template is located under /templates/template_name.
Let me first explain what I am trying to do.
In joomla 3.0 I have created a Menu_Item_Text_Separator override for my template http://docs.joomla.org/Help30:Menus_Menu_Item_Text_Separator. It seems as though joomla will only recognize one default Text separator per template which is ok if you just want the one. but I ideally would like to have the choice of selecting the custom one in my template folder as well as the default one that joomla recognizes. To inform you this is what I have done to make it happen.
in my template I have a folder named html which had a folder called mod_menu inside it.
In the mod_menu folder I have the .php files called:
default_separator.php
custom_separator.php
I then go into menu manager and edit the menu item for which I want to display a text separator for.
I then go to 'template style' http://docs.joomla.org/Help30:Menus_Menu_Item_Text_Separator and look for my custom style. but I only can choose the default one.
So i wonder if this is way that joomla works that you can only have one default per template. but is it possible to have more than one?
any advice most welcome.
regards
w9914420
Sorry this got too long for a comment.
Okay let's start from the beginning. Templates have a set of parameters defined in the templateDetails.xml file. A template style is simple a record containing the information about a template and the array of parameter options you have selected. You can make as many template styles as you want for a given template Each one has its own name. In the menu you can select any of the styles and assign it to a menu item. ....
What you are talking about has nothing to do with template styles. You are talking about using a layout override for mod_menu. Because you are using a file with the same name as a core layout file you should get a 1:1 replacement.
From what I understand of what you want to do, you should instead make a new named replacemen both for default_separator and for default.php. THat's because the alternative layout field is going to look for a replacement for default.php say yourname.php and then in that replacement when you load a template called separator it is automatically going to look for yourname_separator rather than default_separator because it assumes you are appending the _separator to the base name. If you do this it has some advantages such as you will be able to make a more complex layout and it will allow you to load different sub layouts conditionally for example.
I think your are confusing template styles with the style for menu module. Unless you have a parameter in your template that specifies the choice of a mod_menu layout a template style is not going to help you.Go to he module manager and pick the module you want to apply the style to. Use the field to select the layout you want. Or if it is a css style use the style option. It could also be that what you really want is to apply module chrome. THat do can be done by editing the module. If you want to have the same menu with different layouts or styles you'll probably want to make additional modules for that menu.
I had a rethink of what i was trying to do. What I was trying todo could not be achieved through the method I hoped - creating a template for that one text separator would not be practical although I have now discovered how to feed template parameter values into layout overrides.
Thank you Elin for your time
regards w9914420
I inherited a Drupal5 site and have been tasked with making some changes, but I'm unable to figure out where to start looking.
On many pages there is a menu available to administrators that allows you do do certain actions:
Overview
Specialists
Resources and Tools
In the Field
News
Events
Courses
Multimedia
Edit
Track
Workflow
Settings
However, on some sections, there are different options:
Preview
Layout
Settings
Layout settings
Advanced
Context
Content
Export
I need to add (Edit, Track, Workflow, Settings) to the second menu, but I'm not sure how to do that.
I see in page.tpl.php there is region for $tabs, but I can't figure out how this gets built.
From what I can tell, the theme is based on the Zen STARTERKIT theme.
The $tabs variable normally gets populated with menu entries of type MENU_LOCAL_TASK.
Take a look at the menu system, and especially at hook_menu() to get a basic idea. It boils down to a mapping of callback functions to paths. If an URL matches a path defined in hook_menu (can contain placeholders!), the callback function registered for that path will be called to generate the content for that URL.
The 'type' of the hook_menu item defines how the path/callback combination is represented in the system. It can be a MENU_CALLBACK, which would mean just the registered path/callback combination, but no corresponding 'real' menu entry. A MENU_NORMAL_ITEM, would be the same, but with a 'standard' menu entry, e.g. in the navigation menu. A MENU_LOCAL_TASK is the same, but the corresponding menu entry usually shows up in the $tabs and not in a menu.
All MENU_LOCAL_TASK that share the same base path will end up as a group of tabs. So if you had paths like:
some/path/tab1
some/path/tab2
some/path/tab3
and all of these where defined as MENU_LOCAL_TASK, you would see one tab for each of them on each page they represent.
So to find the places you need to modify/enhance, you should search your codebase for all hook_menu() implementations that define the paths where those tabs show up. Note that they need not all be defined at the same place, but could come from different hook_menu implementations in different modules. Than you'd need to add menu definitions for the tabs you want to add, mapping the relevant paths to callback functions. The callback functions would return the content of the pages that the user should see when clicking the tabs.
If you are displaying node, usually there is already the Edit link in the $tabs, since its not present that might be something else (some kind of layout module). You need to add Edit/ Track options to edit/track what kind of content? Specific node or what?
I'm trying to write a slideshow for joomla. Specifically one that will be placed next to an article (no necessarily associated with the article though). Should i write a component, or a module? OR should I write a component that is placed in the page using a module (like the com_banner and mod_banner stuff in the joomla basic installation).
I know I am reinventing the wheel, but I really want to learn about joomla modding.
You want a module. You can assign modules to any menu items.
Modules will appear on that page and "sub-pages". For example, if you assign a module to a menu item that points to a "Article blog layout", then it will appear on that page and the articles linked from it.
If you only want one specific article, or any page without a specific menu item, create a new menu called "hidden menu" and make a menu item in it. Menus don't appear unless you publish the menu module.
By the way, there are many slideshow components for Joomla already out there - Photoslide from gavick.com is pretty good, and free.
If you want to associate the slideshow to a specific article i think you should write a component, because in this way you have more control on the article and you can manage its structure and its layout.