Joomla 3.2 - Load Component View from Specific Menu Item ID inside Another Component - joomla

I'm trying to get my head around Joomla 3.2's new framework and develop a capability/feature in a custom component (lets call it com_custom) that can load com_content's category blog view within com_custom's view, using the category blog's menu item id!
There are quite a few codes that I saw here and around the web that only load the default view of the 'imported' component, rather than the view specified in the imported component's assigned menu parameters. Also, most of these codes use deprecated functions, so I'm quite lost now.
So what I need to be able to add is:
Include a category blog view (say from menu item id 223) within com_custom's current view.
It should import all of the parameter setting of the category blog's menu item.
It should not be in an iFrame
Any help is much appreciated!!!

You can't include com_content because it makes use of the JPATH_COMPONENT constant in 14 different places, most notably in content.php (the main file that's loaded, even before the controller) and in most views, in order to load helpers.
These are the first two ways that come to mind to overcome this limitation:
Instantiate the articles model, load the data, and use your view to display it; you'll need to dig into the menu table to find the params related to your menuid; Bewre: Search engines might consider the duplicate content as spam.
Insert a jquery ajax call to get the url of the menuid adding &tmpl=component i.e.
index.php?option=com_content&view=category&id=13&Itemid=522&tmpl=component
The latter will be much easier to implement. Search Engines will NOT see the different content under different urls, since it's ajax.
Regarding the limitation, see also this question:
Joomla how can i create model from other component

Related

On Joomla, how to show multiple editable articles on the same page?

I have a static website, which I want to make editable by the client. So, I decided to rebuild the website using Joomla. The current static home page uses Zurb's Foundation to display the contents in the following layout.
1st Row: 1 column,
2nd Row: 2 columns,
3rd Row: 1 column
Using Joomal, I have thought of the following options.
the whole page is 1 article: the client would need to understand html, to be able to maintain div's and classes. Isn't it?
Each column on the page (1 column on the 1st row + 2 columns on the 2nd row + 1 column on the 3rd row) is an article that the client can edit. In effect, the page displays the full contents of 4 articles in the above layout.
I think the 2nd option is the way to go. However, I could not figure out how to display multiple, FULL, EDITABLE articles on the same page. I looked at the extension (Articles Anywhere - https://extensions.joomla.org/extension/articles-anywhere). However, it seems that although this extension can display articles, they won't be editable by authorised users.
Your effort and time to answer my question are highly appreciated...
Throughout the last few days, I managed to achieve what I asked about. I thought of documenting it here for the benefit of others.
Let's say we want to create a page, which looks like the following.
1st Row has 1 column: Part-r1-c1
2nd Row has 2 columns: Part-r2-c1 & Part-r2-c2
3rd Row has 1 column: Part-r3-c1
Basically, you need to do the following.
Create a template having module positions for each "Part" of your page layout. Let's call this template "Custom Template". So, you will need to create 4 positions:
Part-r1-c1
Part-r2-c1
Part-r2-c2
Part-r3-c1
Creating a custom template is an involved process with quite a learning curve. You need to be patient until you understand how Joomla templates work. I suggest referring to the official documentation and some tutorial videos/articles. I found the following useful.
Convert an HTML Template to Joomla 2.5/3.0 (3-parts YouTube Video): https://www.youtube.com/watch?v=E13QMWgvwlA&t=3s
https://docs.joomla.org/Creating_a_basic_Joomla!_template
As an alternative to creating your own template, you can use a Template Extension (or framework). I like T3-Framework http://www.t3-framework.org/.
However, in my opinion, investing time in understanding how Joomla templates work has much higher return on investment than understanding how to customise/customize an existing framework. To build your own template, you need to be comfortable with changing php and xml files though.
Create an empty article, and call it something like "Dummy Article".
Create a menu item for your page, e.g. "Services". The type of this menu item should be "single article". Choose the "Dummy Article", which you created above, as the article to be displayed. Assign "Custom Template" to this menu item.
Create an article for each Part of your page, in which you will write the contents, which your customer would be able to change.
Create a module for each Part, and assign it to the related position of the layout, and insert the related article into this module. Inserting articles into modules is not part of standard Joomla (at the current version 3.6.4). To insert articles into modules, you need to use a Joomla extension, like https://extensions.joomla.org/extensions/extension/news-display/articles-anywhere/.
That's it.
I discovered the need for another feature, which I missed asking about in my question. I wanted to make some Parts, which are not editable by the customer. Here's how I did it.
Create a category for articles, which you don't want your customer to change. Let's call it "Protected". Change the permissions for this category to Deny access to Editors (with the assumption that you are going to provide your customer with an Editor User ID.)
Create articles for each Part of your page, in which you will write the contents, which your customer CANNOT change. Categorise these articles as "Protected."
Good Luck!
To display multiple articles on a page you can use the category blog view or the featured view or (with customization) the tagged items view. However you must not use "read more" within the articles. Make sure that the option to display edit icon is turned on and that you are logged in as a user with edit privileges for all of the articles in question. If you are an administrator, publisher or editor by default you will have these.

Sidebar list with cakephp

I want to make a sidebar list so when the user click on the item all the information that related to this item is viewed in a specific area in the same page , and its the same for all items,what is the best way to do that ( AJAX pagination or normal JQuery ) or there is another way to do that?!
The best way to do that is using Extending Views it allows you to warp one view to another .Combining this with view blocks gives you a
powerful way to keep your views DRY.
for more details visit those links :
Extending Views : http://book.cakephp.org/2.0/en/views.html#extending-views
Using View Blocks: http://book.cakephp.org/2.0/en/views.html#using-view-blocks

Joomla custom component item references

I have been following this guide to successfully create a Joomla custom component: http://docs.joomla.org/J2.5:Developing_a_MVC_Component/Introduction
For simplicity's sake lets say I have two tables, one for authors and one for books.
--AUTHORS--
ID
Name
--BOOKS--
ID
Name
Author_reference
Both have two views each, one list view and one edit view. When I click on a author in the list view it takes me to the list view of the books to see what books the author has written, and only those books filtering out the others.
Here the problem start, when I click on the New button in Joomla I want to add a book to that specific author, but have no way to set that reference. So far I have set that reference with a Session variable when clicking the author but that has obvious flaws such as opening another author in a new tab changing the Session variable.
EDIT: Looks like my question was not very specified. I need a way to send a parameter/variable when clicking the "New" button in admin mode in my component.
You can see a good tutorial for this on another question that I answered: How to add a link category_id added to the admin (JToolBarHelper::addNew)? - Joomla 2.5
Basically, joomla has two functions that you can set in the controller for that view to facilitate adding items to the url even through it's redirects as part of the loading, checking out, and save process.
You can build that with the "foreign key" or "category field" functionality in the Joomla Component Creator. It will save you a lot of headake. Give it a try.

How to display list of content items using Telerik Grid component

I'm begginer in the Orchard CMS.
I would like to create Content Type composed from different parts and fields which I know before. I want this content type to be enumerable ie I use content part List, I want to list it using telerik components.
For example my content type is Product and I specify its fields: Price, SKU apart from default: user(who created it) and creation time fields. Moreover the product contains also image gallery, ie image gallery content part.. I want the list of products to be shown using Telerik component Grid, including creation time and user name.
Is it better to create the whole module specifying all its fields(price,SKU) and its templates or is there any way to just take what has been already created in orchard as a content type and display it different way(using telerik)..
thanks for any advice ;)
Tomas
It appears this topic was moved and answered here:
http://orchard.codeplex.com/discussions/371276

Orchard How can I style the summary of list items different in a page versus a widget

I am new to the orchard project, and have not been able to track down how this could be done (assuming its possible).
I have a data list called "Events" in which I have attached a list of custom data type objects which are of type "Event". I then have put a view of this list in a widget on my homepage - as well as displayed the list view page by adding it to my main menu.
I have found the information to update the summary of these list items by adding the proper view
for example adding the following view:
\Themes\PeaceCamp\Views\Items\Content-Event.Summary.cshtml
<div class="event">
<b>#Model.Title</b><br />
</div>
however this seems to update the view in the widget, as well as in the list view page. Since pagination only affects the page view - I presume there is a way to summarize them different in the two different areas - hoping someone could explain or direct me to the proper location to do that - Thanks!
My solution is all local at this time, so I cannot provide links as examples - and the only thing not done in the CMS would be the view added above.
You could add your own IShapeTableProvider (the stuff you describe comes from the Shapes class in Orchard.Core.Contents) that walks up the shape tree to find a parent zone and adds alternates accordingly.
This post might give you some ideas on how to do that:
http://weblogs.asp.net/bleroy/archive/2011/01/10/orchard-shapeshifting.aspx

Resources