A plugin that allows Joom!Fish to work with articles

More
14 years 9 months ago #3124 by ckan
Create the following files:

plugins/system/autoselectlang.php
Code:
<?php // Check to ensure this file is included in Joomla! defined( '_JEXEC' ) or die( 'Restricted access' ); $mainframe->registerEvent('onAfterRoute', 'botAutoSelectLang'); function botAutoSelectLang( $args ) { if (JRequest::getVar('option') == 'com_flexicontent') { if ($aid = JRequest::getInt('id', 0)) { global $mainframe; $lang = $mainframe->getUserState('application.lang'); $db =& JFactory::getDBO(); $query = 'SELECT j.id, ie.language' . ' FROM #__content AS i' . ' INNER JOIN #__content AS j ON i.alias = j.alias AND i.catid = j.catid AND i.state = 1' . ' LEFT JOIN #__flexicontent_items_ext AS ie ON ie.item_id = j.id' . ' WHERE i.id = ' .(int) $aid ; $db->setQuery($query); $items = $db->loadObjectList(); foreach($items as $item) { if(substr($item->language, 0, 2) == substr($lang, 0, 2)) { JRequest::setVar('id', $item->id); break; } } } } } ?>
plugins/system/autoselectlang.xml
Code:
<?xml version="1.0" encoding="UTF-8"?> <install version="1.5.0" type="plugin" group="content"> <name>Auto Language Selection</name> <author>Caesar KAN</author> <creationDate>January 2010</creationDate> <copyright>Copyright (C) 2010 Orderly Software. All rights reserved.</copyright> <license></license> <authorEmail>ckan@as05.com</authorEmail> <authorUrl></authorUrl> <version>1.0.0</version> <description>Displays Flexicontent article of the current language.</description> <files> <filename plugin="autoselectlang">autoselectlang.php</filename> </files> <params> </params> </install>
Register the plugin:
INSERT INTO `jos_plugins` (`id`, `name`, `element`, `folder`, `access`, `ordering`, `published`, `iscore`, `client_id`, `checked_out`, `checked_out_time`, `params`) VALUES
(68, 'System - Auto language Selection', 'autoselectlang', 'system', 0, 0, 1, 0, 0, 0, '0000-00-00 00:00:00', '')

Comment out the following lines in components/com_flexicontent/views/items/view.html.php:
Code:
//special to hide the joomfish language selector on item views //$css = '#jflanguageselection { visibility:hidden; }'; //$document->addStyleDeclaration($css);
Create different language versions of the same article using the same alias. (IMPORTANT!!)

Please Log in or Create an account to join the conversation.

More
14 years 9 months ago #3339 by KingoftheRoad
Hi there,

With this plugin, Can Flexicontent Item work with Joomfish module? I found Joomla language selection module disappears in item view ( www.flexicontent.org/forum/index ... =viewtopic ).

Can this plugin solve this problem?

Many thanks.

Seth

Please Log in or Create an account to join the conversation.

More
14 years 8 months ago #3353 by ckan
Yes, that is exactly what this plugin designed for!

To show the Joom!Fish language selection module, you can comment out the following lines in components/com_flexicontent/views/items/view.html.php:

//special to hide the joomfish language selector on item views
$css = '#jflanguageselection { visibility:hidden; }';
$document->addStyleDeclaration($css);

Please Log in or Create an account to join the conversation.

More
14 years 8 months ago #3355 by KingoftheRoad
Thank you so much! Hope this feature can be added in the stable release..

Seth

Please Log in or Create an account to join the conversation.

More
14 years 8 months ago #3531 by vistamedia
Clever ;-)
I'll add the ability to show/hide the language selector (in item views) as a parameter.
Thanks a lot for this plugin,
Emmanuel.

FLEXIcontent lead developer.
www.vistamedia.fr web agency and custom development.
www.joomla.fr co-administrator.
Please no PM for support request, use the forum for that!!!

Please Log in or Create an account to join the conversation.

More
14 years 5 months ago #6915 by nico65
yeah, this plugin makes flexicontent work like expected!
I just have this problem:
On my localhost installation, everything works fine without errors. And on my webspace I got this error:

Warning: Missing argument 1 for botAutoSelectLang() in /hermes/web01/xxx/xxx/mydomain.de/plugins/system/autoselectlang.php on line 7

is there a way I can fix it (beside php_flag display_errors off)

nico

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.294 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline