Alternative Menu Items?

134 views
Skip to first unread message

Emma Badger

unread,
Feb 20, 2012, 12:50:33 PM2/20/12
to joomla-de...@googlegroups.com

I'm having another go at this, having upgraded to 2.5, but still having problems.

I want to change the way that the Create Article page works for a certain category - not show certain fields like the Alias, and change the order of fields, for example.  I'll also want to change the way that articles for a given category are displayed when I get this working.

I've copied 
components/com_content/views/form/tpl/edit.xml
components/com_content/views/form/tpl/edit.php
to
templates/mytemplate/html/com_content/form/editarticle.xml
templates/mytemplate/html/com_content/form/editarticle.php

(also tried
components/com_content/views/form/tpl/edit.xml
components/com_content/views/form/tpl/edit.php
to
templates/mytemplate/html/com_content/article/editarticle.xml
templates/mytemplate/html/com_content/article/editarticle.php)

In the xml file I changed
<layout title="COM_CONTENT_FORM_VIEW_TRAIL_TITLE" option="COM_CONTENT_FORM_VIEW_TRAIL_OPTION">
and the option shows directly under Create Article when I add a new menu item.
I've made no other changes to the files.

When I click on the new menu item in the front end (whether I've copied the files to
templates/mytemplate/html/com_content/form/editarticle.xml
templates/mytemplate/html/com_content/form/editarticle.php
or
templates/mytemplate/html/com_content/article/editarticle.xml
templates/mytemplate/html/com_content/article/editarticle.php)
I get

Error:500

You may not be able to visit this page because of:

  1. an out-of-date bookmark/favourite
  2. a search engine that has an out-of-date listing for this site
  3. a mistyped address
  4. you have no access to this page
  5. The requested resource was not found.
  6. An error has occurred while processing your request.

So
1) Is it an Alternative Menu Item that I need or should I be looking at an alternative solution?
2) If it is an Alternative Menu Item that I need, can someone point me in the direction of getting it working please?

Thanks in anticipation.



Mark Dexter

unread,
Feb 20, 2012, 1:36:44 PM2/20/12
to joomla-de...@googlegroups.com
Hi Emma. I have never tried it with an edit view. Maybe you could try it with a category listing (as per the tutorial here: http://docs.joomla.org/Layout_Overrides_in_Joomla_1.6.) That should work then you can compare what you did to that one. Good luck. Mark

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

Emma Badger

unread,
Feb 21, 2012, 2:23:09 AM2/21/12
to joomla-de...@googlegroups.com
Thanks Mark, I'll try that. 

Sent from my iPhone

Emma Badger

unread,
Feb 22, 2012, 6:59:34 AM2/22/12
to joomla-de...@googlegroups.com
I've copied 
components/com_content/views/article/tmpl/default.php
components/com_content/views/article/tmpl/default.xml
to 
templates/mytemplate/html/com_content/article/newdefault.php
templates/mytemplate/html/com_content/article/newdefault.xml
and applied it to a menu and it's successfully showing an article.

I think the problem must be where I'm putting the copied files.  I want to make an alternative layout for creating an article.  I've identified components/com_content/views/form/tpl/edit.php as being the default create article file.  Can anyone point me to where I should be copying this to please?

Thanks in anticipation.

elin

unread,
Feb 22, 2012, 8:03:40 AM2/22/12
to joomla-de...@googlegroups.com
templates/mytemplate/html/com_content/article/form

Emma Badger

unread,
Feb 22, 2012, 8:36:29 AM2/22/12
to joomla-de...@googlegroups.com
Thanks, but 

templates/mytemplate/html/com_content/article/form/newedit.php
templates/mytemplate/html/com_content/article/form/newedit.xml

doesn't show up as an item that I can add to the menu, whereas 

templates/mytemplate/html/com_content/form/newedit.php
templates/mytemplate/html/com_content/form/newedit.xml

does, but gave me a 500 error when I click on the menu item.

Submit article works
index.php?option=com_content&view=form&layout=edit

View article works
index.php?option=com_content&view=article

(Overriden) View article works
index.php?option=com_content&view=article&layout=beez_20:newdefault

(Overriden) Submit article gives error 500
index.php?option=com_content&view=form&layout=beez_20:newedit

So it looks like the syntax of the URL is correct, and even the placement of the files, since they're showing in the menu item selector, and in the correct place.

All I've done is copied
components/com_content/views/form/tpl/edit.xml
components/com_content/views/form/tpl/edit.php
to
templates/mytemplate/html/com_content/form/newedit.xml
templates/mytemplate/html/com_content/form/newedit.php
and changed the layout title and option, just so I could identify the new menu item.  I haven't added to the xml, or made any changes to the php file.

Should I be able to override create/edit article, or can you just override the view article?

Are we assuming that it's not a bug as the override has only been tested with view and not create/edit?

Thanks again.




On 22 Feb 2012, at 13:03, elin wrote:

templates/mytemplate/html/com_content/article/form


--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/OMlNYXfNWd8J.

elin

unread,
Feb 22, 2012, 11:54:35 PM2/22/12
to joomla-de...@googlegroups.com
Right did not mean to have article there.

II can confirm this issue. Will you please post it in the tracker?


Elin

elin

unread,
Feb 23, 2012, 12:22:23 AM2/23/12
to joomla-de...@googlegroups.com
I think this is probably because of something I mentioned not that long ago in another thread, which is that front end forms have this conventional structure where the view is called form and the layout is called edit rather than default like in a normal view. So in playing around one thing I found is that it seems as though if you name your override default it seems to work more like what you would expect. It may be that the alternative menu layout code is assuming there is something called default that is supposed to be replaced.

Elin

Emma Badger

unread,
Feb 23, 2012, 2:46:10 AM2/23/12
to joomla-de...@googlegroups.com
Thanks.

Copying
components/com_content/views/form/tpl/edit.xml
components/com_content/views/form/tpl/edit.php
to
templates/mytemplate/html/com_content/form/default.xml
templates/mytemplate/html/com_content/form/default.php
does give me an alternative menu, and it does work in the frontend.

It doesn't honour the 
<fields name="params">
<fieldset name="basic">
<field name="enable_category" 
type="radio" 
default="0" 
label="COM_CONTENT_CREATE_ARTICLE_CATEGORY_LABEL" 
description="COM_CONTENT_CREATE_ARTICLE_CATEGORY_DESC">
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field name="catid" 
type="category" 
label="JGLOBAL_CHOOSE_CATEGORY_LABEL" 
extension="com_content" 
description="JGLOBAL_CHOOSE_CATEGORY_DESC" />
</fieldset>
</fields>
and therefore doesn't let me default the category.  


Thanks for your help.

On 23 Feb 2012, at 05:22, elin wrote:

I think this is probably because of something I mentioned not that long ago in another thread, which is that front end forms have this conventional structure where the view is called form and the layout is called edit rather than default like in a normal view. So in playing around one thing I found is that it seems as though if you name your override default it seems to work more like what you would expect. It may be that the alternative menu layout code is assuming there is something called default that is supposed to be replaced.

Elin

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/mlu1HBVBznkJ.
Reply all
Reply to author
Forward
0 new messages