So I am using the latestnews_modules in joomla, and I am rendering latest_news at the footer of the site, but also I need to render at the right other latest_news, but I see only one view default.php, how can I make that one module works different in each position???
if I create another module like the previous, they bot have the same behavior, how can this be solved, help!!
There should be configurable settings for the module:
Go to the module you wish to change
Look on the right; you should see a 'panel' headed 'Parameters'
You can set things such as the total count, the section/category to pull articles from, authors to include, and the order.
If your requirements are different from that offered by the module, you'll need to either create your own custom extension, or find a third-party extension that does what you want.
What are you trying to achieve?
a) If you want different "behaviour", i.e. different functionality you need two different modules and in that case would need to clone the latestnews module with your modifications. By the way, if you are modifying the code of core modules you really should do this using template overrides in case you end up losing your changes after a security patch - unlikely for this module, but possible.
b) If you want the same behaviour with different parameters do as Bobby Jack says and change the settings for one of the modules by going to the Module Manager, selecting the module and changing it's settings, e.g. how many items to display and from what category.
c) If you want different styling for the two modules use the Module Class Suffix to change the class attribute of one of the modules and write CSS to override the display of the relevant module instance.
Related
Consider situation where I have some default bundle that hypothetically create some empty page with menu on left and some content (if there is any). Then I create a new bundle and I normally turn it on in AppKernel. Now should magic start: bundle by his own (no need to add any options in default bundle etc.) hooks up and creates his menu entry (and if chosen, renders his content). How should I do this, is there any proper way to do this? What if I want to have multiple "hooks", for example, adding also new form in user profile edit, or adding new tab on some other place?
I'm thinking about looking for some "initialize bundle event" that I could listen to and pass data thru it. But maybe there is better solution. I would love to see your ideas :)
Looking at the initializeBundles method of the Kernel, it doesn't look easy or intended to dynamically add bundles during the bootup process.
However, the AppKernel.php file is on the forefront, it is an override of Kernel and can be customized to supply a dynamic set of bundles to the implemented registerBundles method.
You will need to make sure the imported content is properly added to the autoloader, but avoid modifying the distribution source at runtime, try to make it as imported as possible.
I don't want to go into great detail on the technicalities as I have not done this myself and it will require a lot of experimentation. I do know that Drupal 8 uses Symfony2 and has its own plugin system, but I don't think it takes bundles as plugins.
If you manage to pull this off I suspect it will allow 100% integration between the application and the plugins, but just be aware that it also allows 100% overriding access to said plugins.
In a joomla menu item page i placed same module instances multiple times(i duplicated in module manager).Now it's a severe requirement that some codes of my module have to be only one time in page.Because my module's each instance injects same code again and again.
how to avoid it so that only some codes will appear in page only once when i have multiple module instances of my module in that same page?
searching through web i found some unreliable ways -
1.Using session in module i track whether same module loading two or more times and restrict code injecting one time only
2.using a constant like this way -
if(!defined('MODULE_ALREADY_LOADED')){
//echo codes that you only want done once
//this will set the constant and now the other modules won't load/echo the code
define('MODULE_ALREADY_LOADED', true);
}
But not sure how much compatible the 2nd way is with joomla 2.5 as well as joomla 3 versions !.If there is a better error free way to do this then provide to me asap.
in your module code, you can use addscript method (it checks the duplicate scripts) instead of writing js directly. So, externalize your scripts, then in your code :
$document = JFactory::getDocument();
$document->addScript('your_script.js');
Ok this is just something I feel I should ask as I could not find any reference to this in any kind of documentation, and reading through the actual code to figure out the best way to accomplish this would take far longer then hope to spend.
When you enter the Article manager you have a navigation link to the Category manager and vice versa. I would like to do something similar with my component and the default User manager.
I already have a profile plugin to extend the users to suit my needs, but I would like the configuration of it seamless so adjusting the com_user component to integrate better with my component is what I am looking for.
So my question is with the com_content and com_categories they use the "extension" parameter. Is it possible to add similar functionality without a full core override of the com_users? If I do a full override there is a chance of some extensions not working due to reliance on the users.
I am willing to clarify if anything does not make sense, this question is more to see the extent you can "extend" Joomla without overrides.
UPDATE:
I have found a cool technique, not quite an answer though.
You can override just the list controller/model/view in your component, and if you based it off of the current com_users component you can make it look like a direct integration.
The only edits you need to do is making sure any routes to the users view instead pass to your component.
There is one issue with this however, when you add a new user or edit one, once you finish it will direct you to the main user manager. A system plugin may help with this but only if there is a reliable way to detect when the user was edited through your component, rather then the users manager.
Note: The problem with adding an override to the user view is that it has 5-6 other MVC components it relies on, so in the interest of making it easy to update with core com_users updates it is best to avoid that if at all possible.
Another thing needed is to make sure to find the language file for com_users and add all entries to your component.
I feel there may still be a better answer out there, but doing it this way does not impact the core much, and would be easy to update with updates to com_users.
I am opening a bounty on this, I feel of every question I ever asked this is one that will have the most benefit to the community. So here is a condensed version of the question.
What would be an easy way to integrate a core component into a custom component and have it route through that component seamlessly with the least edits to the core component.
I'm not exactly clear on what you want but if you're talking about the toolbar submenu's like this in com_content:
The example you give of Categories (i.e. com_categories) is specific support added where you can pass in a link to com_catgories with your extension identifier (the extension=com_mycomponent) and it will load the sidebar menu for your extension. This is so core categories can be shared amongst various components [see Add Categories].
You may already be aware of the following, but, if you want to know how to add a sidebar menu to your components manager view you can call JHtmlSidebar::addEntry($title, $link, $active);
Typically this is put in your extensions primary helper file in a function called addSubmenu($vName) (which is what & where com_categories will look for to display your toolbar sub-menu). Its called addSubmenu() because the sidebar morphed from being the toolbar submenu in previous versions of Joomla.
e.g. this is the addSubmenu() method in the ContentHelper class defined in administrator/com_content/helpers/content.php
/**
* Configure the Linkbar.
*
* #param string $vName The name of the active view.
*
* #return void
* #since 1.6
*/
public static function addSubmenu($vName)
{
JHtmlSidebar::addEntry(
JText::_('JGLOBAL_ARTICLES'),
'index.php?option=com_content&view=articles',
$vName == 'articles'
);
JHtmlSidebar::addEntry(
JText::_('COM_CONTENT_SUBMENU_CATEGORIES'),
'index.php?option=com_categories&extension=com_content',
$vName == 'categories');
JHtmlSidebar::addEntry(
JText::_('COM_CONTENT_SUBMENU_FEATURED'),
'index.php?option=com_content&view=featured',
$vName == 'featured'
);
}
By comparison the com_categories helper class CategoriesHelper has a very different addSubmenu() method which looks for the calling extensions core helper class (if one isn't found it defaults to com_content).
There isn't any support like that in com_users so you will probably have to create a system plugin that fires onAfterRoute and adds your submenu item based whether or not your component has provided a suitable parameter, like the extension=com_myextension. It would be a bit of a swizzle but it should work — the only thing is as you would be adding a submenu item before the component is dispatched your new submenu item would like always be the first item in the com_users submenu. It wouldn't be a complete replacement like com_categories supports.
Unfortunately there aren't any triggers in com_users that I can find that would be of any help in swizzling the entire sidebar menu.
The next option is to use something like Donald Gilbert's gist to create a system plugin that allows you to override any core class by creating a substitute version of your own — obviously this will have issues with any significant updates but if you're careful you could limit the override to your specific situation.
If thats not enough/overkill you may want to try a system plugin that responds to onAfterDispatch at which point you would have the page before its returned to browser and you could hack the HTML, but thats very ugly and be prone to breaking if users change their admin template.
Of course, I could be completely wrong and theres a better way to do it in 3.x. Maybe someone else will chime in.
I have two part of application. The first is a manager panel and it is pointed to http://mysite.com/. Other is a personal product page and they are pointed to own domein http://product_domain.com/ . These are parts have two different router maps but common models, components and widgets. The list of all product domain I have saved in database.
What the best way to separate this parts?
P.S. Maybe i should have two different application or config?
What we usually do is use a combination of a "prerouter" and modile.
Yii supports this by way of an "onbeginrequest" => array('Class', 'function') in your config.
In that function you can detect where the user came from and make the needed changes. For example activate a specific module (if all the functionality is grouped in one), or set a different defaultController. Perhaps you want to load a custom theme?
You can do it all in there before anything is done.
I am using Symfony 1-4 and sfDoctrineGuardPlugin.
My question is, on Doctrine Guard Plugin as you know each module came with generator.yml. And i need to customize generator.yml. For example, i need to display another table's (module's) column.
// for example i am at X module and need to sort according to another table's/module's column
...
config:
list:
sort: [X, asc] // x is not on my module
Same thing with list/display. I need to display some column which is not on my current module...
I couldn't find it on the web. Thanks a lot for sharing your idea and/or information, erman.
Never mind to customize any file directly in the plugin's dir.
Override generator.yml by copying it into your application's module. The module must be the same name as in plugin. See "Anatomy of a Plug-in".
Symfony does not provide a built-in functionality to sort items by columns that don't present in current model. You have to do it manually by overriding an addSortQuery method in your actions class. See "Symfony 1.4 admin generator sort on custom column".
Hope this would help.