In Joomla 3 I have a need to specify different admin templates for K2 articles based on category to be able to specify different extra fields and make it easier for content contributors to add items.
I thought I'd found the perfect solution, but it was written several years ago for older versions of Joomla. I did contact the author and he admitted writing it several years ago, has since quit using Joomla and was not able to advise me.
It is very similar to overriding front-end k2 templates. Here is the article describing it:
http://getk2.org/documentation/tips-a-tricks/221-custom-admin-templates-and-calling-specific-extra-field-data
However when I do this and modify a category's admin template, there is no change from the default. My thought is that something in this code which modifies the file administrator/components/com_k2/views/item/view.html.php is not compatible with Joomla v.3:
//Look for specific admin template file
jimport('joomla.filesystem.folder');
$componentPath = JPATH_SITE.DS.'components'.DS.'com_k2'.DS.'templates';
$componentFolders = JFolder::folders($componentPath);
$db =& JFactory::getDBO();
$query = "SELECT template FROM #__templates_menu WHERE client_id = 0 AND menuid = 0";
$db->setQuery($query);
$defaultemplate = $db->loadResult();
if (JFolder::exists(JPATH_SITE.DS.'templates'.DS.$defaultemplate.DS.'html'.DS.'com_k2'.DS.'templates'.DS.'admin'.DS.$item->catid))
{
$this->_addPath('template',
JPATH_SITE.DS.'templates'.DS.$defaultemplate.DS.'html'.DS.'com_k2'.DS.'templates'.DS.'admin'.DS.$item->catid);
}
Already, I know there is no table in my db with the name "templates_menu". That threw an error immediately. I believe it should template_styles", and most likely the columns should be client_id and id. Making those changes eliminated the error at least.
Further, I believe the path is incorrect in the "if" statement. The second "templates" directory is not needed.
However, even after making these changes, I do not seem to be pulling in my new template on the admin side.
I am hoping a Joomla/PHP expert (which I am not) can weigh in here. I could be entirely wrong in my assumptions about the pathing and table name.
Edit: In researching this further, I decided to go ahead and CREATE the table that was indicated in the original poster's code. I now have a table in my database called e758z_templates_menu.
However, I still get nothing when trying to make Joomla use a custom admin template connected to a category ID. It continues to use the default one.
Can you not just create different extra filed groups and then assign the right ones to the right category?
If you modify the k2 core files then any changes will be wiped on an update, which, with the new 1-click updates would be quite likely.
You should be able to override the standard admin view with a standard template override, ie
copy
/administrator/components/com_k2/views/category/default.php
to
/administrator/templates/YOUR_ADMIN_TEMPLATE/html/com_k2/category/default.php
If you want them to be different for different categories then why don't you create a frontend login and then use different templates for different categories and override them in the standard way.
Related
Overview:
I have a single Joomla website that have various copies of the database tables all in the same database, but with different table prefixes.
Depending on which user is accessing the site, i need to alter which joomla table prefix is used in order to display the relevant tables.
This has to be site wide.
Problem:
with a core code hack i can alter the prefix as needed, but would prefer this as a plugin.
With the plugin i can get the prefix, using $db->getPrefix(), and i can set an immediate instance of the connection using $db = JDatabaseDriver::getInstance( $option ). But this is not site wide and is overwritten by the standard $db = JFactory::getDbo().
So i need a system plugin that will repalce every instance of a table prefix as it is run.
Any ideas?
Sorry but if you install a new component or module you have many problem to synchronize this changes on all DB. I think the best for you is to redirect each user to his real site (many joomla file with many db).
Otherwise you can create a personal component and read table prefix of that user and display only date that you want, in this way just duplicate the tables you need and not all the joomla structure.
I needed a component for specific catalog, so I've paid for it to one freelancer. As it turned out, he's not very good at his job and I was given a component that works only partly. The biggest issues are router, breadcrumbs and json array for parent categories.
1. Router
currently it shows only domain.com/menuitem/viewname?id=X. There are 4 different views that looks like are not connected at all. in db, every view has its own table as it was requested, important fields are as follows:
Main Categories (root):
id, name, alias
General Categories:
id, name, alias, root_id
General Subcategories:
id, name, alias, cat_id
Detail:
id, name, alias, subcat_id[json array]
What I would like to do is to make SEF urls to look like this: domain.com/menuitem/root_alias/category_alias/subcategory_alias/detail_alias but I was told that it can't be done this way. I checked the SEF documentation on joomla portal but I can't figure it out (if it's even possible and if not, what would be a good SEO approach).
2. Breadcrumbs
Maybe it's caused by router and separate views, but they always show Home > Menuitem, but in mainmenu it's only /alias while in breadcrumbs it's /alias/mainview. I found how to add custom breadcrumbs into pathway on joomla portal, but I can't figure out how to get parent items. If there was a solution with SQL I could use it would be enough.
3. JSON array in db
I would like to change it to integer value and add new table subcategory_detail_xref so I can find items easily. Only way I can do it now is by using regular expression in SQL which I don't think is a good idea. I've checked tutorials on joomla portal but it looks just too complicated.
Any ideas, links to examples or tutorials that can help or solutions are highly appreciated.
PS: My website is running on latest Joomla (3.5) so if there are solutions only available for 3.5+ it's fine, I don't have any plans to downgrade
For router source code, you can refer to com_content, it's similar yours, in the 3.5 version, the router has to implement an interface.
There is no detail document at Joomla Developer site, com_content is exactly what you can learn to get it.
The breadcrumb you have to develop similar of router logic
Category table should extend the JNestedTable for multiple level tree structure
I am new to Magento. I am working on Magento 1.8 and having problem while creating multi-store-views for different language's. I have done some configuration from backend, I gpt the multiple-store-view. Its converted from English to French but its not converting to Malaysia language. my steps are as follows
Note: I am using responsive custom theme.
Go to the site: http://www.magentocommerce.com/translations and download the proper language that you are looking for.
Extract and upload the files you downloaded to your Magento’s root directory. Keep in mind it will upload files to your app folder in Magento, but unless you try with a language that you already have there, it won’t overwrite anything as it’s a new language.
Once you finish uploading, go to your Magento’s Admin.
Go to: System>Manage Stores.
Click on “Create A Store View”.
Once there comes the really important thing: Put the name you want for the “Name” field, but in your “Code” field, make sure you enter your main theme followed by a “_” (underscore) and then the name of the language you want to use. Even if you used a new template that you did or purchase it would be under a main template type (default or base). Let’s say you have a new template you purchased called “MAG0873″ and its folder resides under “default”. Also, let’s say you installed Spanish language, then you would put “default_spanish” in this field.
Save it and now go to: System>Configuration.
There, select your new Store View name from the “Current Configuration Scope” item in the top left column.
Now, go to the option: General>Locale.
After that, uncheck the option “Use Website” and make sure you change “Locale” field to the language you downloaded (be specific according to the dropdown list!).
Save it after changing it and now clean your cache and refresh your FrontEnd.
Now, few important things:
If you didn’t deactivate the original Store View a new dropdown will appear in the FrontEnd to change the language and the new Store View’s Name will appear there. Once you select it, the entire template should switch its language.
It might happen it switches language but, it also shows old/default template, well, no worries, this means you need to set up your new Store View to use the proper template according to your design set up. The next steps are specific for the persons who install templates through the System>Design option as I do (which I think is the easier and faster way).
Go to System>Design
Add a new Design.
In the “Store” field, select the new Store View you recently created.
.Now select the “Custom Design” you previously installed in your system.
Save it.
Now, your store should be using the proper design in the proper Store View (language).
Ok, now it happens that the hoe page doesn’t show exactly as you had it on the original (English) language? Well, it might be happening that the Home page is set up for an specific Store View. To fix it, just go to CMS>Pages, now click on the “Home” record (assuming you are using default settings that come with Magento) and then in its options make sure you have “Store View” field set up to “All Store Views”. Save it now.
What's mistake i have done here.
Thanks in advance
If you'd like to have a well configured multi-language Magento setup you need to follow the steps below:
Setup a separate Store View for each language (System -> Manage
Stores -> Create store view);
Apply a Locale for each Store View (System -> Configuration ->
General -> Locale Options, select Desired Store View in "Current
Configuration Scope" drop-down in left-side navigation);
Make sure that you have translated all of your CMS pages to all of
your languages. You need to create a unique CMS page for each store
view;
If you'd like to use a separate theme for each language just do it in
System–>Configuration–>General under the Design tab;
In case you need to make a different set of categories in Navigation
menu for each store view, you may control it by "Include in Navigation
Menu" category attribute (Just choose a category for edit and go to
General Information tab). Change all text attributes in Catalog Products and Categories for
each store view
The more detailed guide find here:
http://sherodesigns.com/magento-tutorial/magento-tutorial-creating-multi-language-stores/
I wrote a plugin for WordPress which has a few user-configurable settings that are stored using WordPress's suggested method. I know they are saved in the wp_options table, but that is abstracted by the WordPress options API.
Now I'm trying to add a "global override" of the settings that can be configured in the Network Admin section of a multi-site installation. I found the appropriate hooks to design my settings page, however I can't find any info about where to save the data.
If I save it using the normal options API, then the settings get saved individually for each site. I'm looking for a place to save them globally for all sites, so the plugin can first look to see if the settings have been globally overridden by the server admin.
I can just write some code to write directly to the wp_options table of one of the sites (for example site #1) or even create my own table. I know how to do all of these things, but I don't want to do that if there's a preferred way to write mult-site plugins.
Thanks for any advice.
As you know the main deference between developing a single WordPress plugin vs. a multisite plugin is where data is written. According to this article since plugins normally have complete reign over one database, and in some cases the plugins local pages files you must be sure to only call the $wpdb global object instead of a hard-coded reference to a table.
For example, if you need to execute an SQL command on the posts table, then do not use wp_posts as the table name $post_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM wp_posts"));
use this
$post_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->posts"));
Please see the article for further info.
We are new to Expression Engine and could maybe use some help from anyone who has built a few sites using this CMS.
We have a small dashboard system where users log in and read articles that are submitted from other authors. We are wanting to have a form which allows a member to chose which categories of articles he would like to be on his home page when he logs in. Then we'd like to figure out how to actually create that home page so that only the categories of articles that the user has chosen are visible.
From a DB standpoint this seems to be a one to many relationship between a member and categories, but we don't have a clear idea how to accomplish this inside of EE (without raw PHP/queries), especially using the Member module, since it isn't a channel and doesn't seem to allow creating relationships in the member custom fields.
We looked at creating a custom field for every category type, but there are about 95, and as we add or remove them, it would be extremely cumbersome to try to keep up with them all. Even if we did we still aren't sure how to connect 1 member to many categories or many entries via a category.
We'll update the question later to add some of the code we (if any) that we've come up with
In short, there isn't going to be a built in way to handle this. That isn't to say however that this can't be handled with some modules that are already out there. Let me ask you this. When you have users logging in, are they logging in to Expression Engine itself's backend, or the login system that you have created on a public facing website.