-
Posts
8 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
lukejd83's Achievements

Newbie (1/5)
0
Reputation
-
Wow, went to sleep and got pushed to page 4... Can anyone assist?
-
The exact warning when i search in Joomla with the plugin enabled is this: ( Replaced my root path with *) Warning: Invalid argument supplied for foreach() in /*/*/*/*/*/*/html/plugins/search/hdflvsearch.php on line 110 the foreach is the foreach after the query.
-
Hi all! I have racked my brain trying to figure this one out. I'm typically a smart cookie, but since I am kinda new to php and mysql, I'm stumped. I'm just trying to program a Joomla search plugin that queries my HDFLV player database, so videos are searchable, but I keep getting an invalid "foreach(" command. It's supposed to be there to interpret the database query, right? I'll post my code here, can someone give me some insight? <?php /** * @version $Id: contacts.php 10381 2008-06-01 03:35:53Z pasamio $ * @package Joomla * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. * @license GNU/GPL, see LICENSE.php * Joomla! is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); $mainframe->registerEvent( 'onSearch', 'plgSearchhdflvplayer' ); $mainframe->registerEvent( 'onSearchAreas', 'plgSearchhdflvplayerAreas' ); JPlugin::loadLanguage( 'plg_search_hdflvplayer' ); /** * @return array An array of search areas */ function &plgSearchhdflvplayerAreas() { static $areas = array( 'hdflvplayer' => 'Videos' ); return $areas; } /** * Contacts Search method * * The sql must return the following fields that are used in a common display * routine: href, title, section, created, text, browsernav * @param string Target search string * @param string mathcing option, exact|any|all * @param string ordering option, newest|oldest|popular|alpha|category */ function plgSearchhdflvplayer( $text, $phrase='', $ordering='', $areas=null ) { $db =& JFactory::getDBO(); $user =& JFactory::getUser(); if (is_array( $areas )) { if (!array_intersect( $areas, array_keys( plgSearchhdflvplayerAreas() ) )) { return array(); } } // load plugin params info $plugin =& JPluginHelper::getPlugin('search', 'hdflvplayer'); $pluginParams = new JParameter( $plugin->params ); $limit = $pluginParams->def( 'search_limit', 50 ); $text = trim( $text ); if ($text == '') { return array(); } $section = JText::_( 'hdflvplayer' ); switch ( $ordering ) { case 'oldest': $order = 'a.id ASC'; break; case 'popular': $order = 'a.times_viewed DESC'; break; case 'alpha': $order = 'a.title ASC'; break; case 'category': $order = 'b.title ASC, a.title ASC'; break; case 'newest': default: $order = 'a.id DESC'; } $text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false ); $query = 'SELECT a.title AS title, "" AS created,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, ' . ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END AS catslug, ' . ' CONCAT_WS( ", ", a.title, a.description ) AS text,' . ' CONCAT_WS( " / ", '.$db->Quote($section).', b.title ) AS section,' . ' "2" AS browsernav' . ' FROM #__hdflvplayerupload AS a' . ' INNER JOIN #__hdflvplayername AS b ON b.id = a.catid' . ' WHERE ( a.title LIKE '.$text . ' OR a.description LIKE '.$text.' )' . ' AND a.published = 1' . ' AND b.published = 1' . ' AND a.access <= '.(int) $user->get( 'aid' ) . ' AND b.access <= '.(int) $user->get( 'aid' ) . ' GROUP BY a.id' . ' ORDER BY '. $order ; $db->setQuery( $query, 0, $limit ); $rows = $db->loadObjectList(); foreach($rows as $key => $row) { $rows[$key]->href = '?pid='.$row->slug; } return $rows; } ANY help is more than what I got from HDFLV Player support. Thank you so much in advance!
-
I would just do this <?php if($option=="com_djcatalog2") { ?> some code <?php } else { ?> some code <?php } ?>
-
Something like lynda.com should help you get started.
-
Is is better to learn php or cms for a beginner
lukejd83 replied to stevehoward's topic in Applications
If you're asking about whether you should learn a CMS (Joomla) or php, I would just stick with Joomla. Quite easy to pick up, and if you need to learn php along the way to edit your Joomla site, take it as it comes. -
I hate to bump my own topic, but can someone please assist? And if I'm not asking properly or doing some thing wrong, will someone tell me?
-
Hi all! I have racked my brain trying to figure this one out. I'm typically a smart cookie, but since I am new to php and mysql, I'm stumped. I'm just trying to program a Joomla search plugin that queries my HDFLV player database, so videos are searchable, but I keep getting an invalid "foreach(" command. It's supposed to be there to interpret the database query, right? I'll post my code here, can someone give me some insight? <?php /** * @version $Id: contacts.php 10381 2008-06-01 03:35:53Z pasamio $ * @package Joomla * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. * @license GNU/GPL, see LICENSE.php * Joomla! is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ // no direct access defined( '_JEXEC' ) or die( 'Restricted access' ); $mainframe->registerEvent( 'onSearch', 'plgSearchhdflvplayer' ); $mainframe->registerEvent( 'onSearchAreas', 'plgSearchhdflvplayerAreas' ); JPlugin::loadLanguage( 'plg_search_hdflvplayer' ); /** * @return array An array of search areas */ function &plgSearchhdflvplayerAreas() { static $areas = array( 'hdflvplayer' => 'Videos' ); return $areas; } /** * Contacts Search method * * The sql must return the following fields that are used in a common display * routine: href, title, section, created, text, browsernav * @param string Target search string * @param string mathcing option, exact|any|all * @param string ordering option, newest|oldest|popular|alpha|category */ function plgSearchhdflvplayer( $text, $phrase='', $ordering='', $areas=null ) { $db =& JFactory::getDBO(); $user =& JFactory::getUser(); if (is_array( $areas )) { if (!array_intersect( $areas, array_keys( plgSearchhdflvplayerAreas() ) )) { return array(); } } // load plugin params info $plugin =& JPluginHelper::getPlugin('search', 'hdflvplayer'); $pluginParams = new JParameter( $plugin->params ); $limit = $pluginParams->def( 'search_limit', 50 ); $text = trim( $text ); if ($text == '') { return array(); } $section = JText::_( 'hdflvplayer' ); switch ( $ordering ) { case 'oldest': $order = 'a.id ASC'; break; case 'popular': $order = 'a.times_viewed DESC'; break; case 'alpha': $order = 'a.title ASC'; break; case 'category': $order = 'b.title ASC, a.title ASC'; break; case 'newest': default: $order = 'a.id DESC'; } $text = $db->Quote( '%'.$db->getEscaped( $text, true ).'%', false ); $query = 'SELECT a.title AS title, "" AS created,' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug, ' . ' CASE WHEN CHAR_LENGTH(b.alias) THEN CONCAT_WS(\':\', b.id, b.alias) ELSE b.id END AS catslug, ' . ' CONCAT_WS( ", ", a.title, a.description ) AS text,' . ' CONCAT_WS( " / ", '.$db->Quote($section).', b.title ) AS section,' . ' "2" AS browsernav' . ' FROM #__hdflvplayerupload AS a' . ' INNER JOIN #__hdflvplayername AS b ON b.id = a.catid' . ' WHERE ( a.title LIKE '.$text . ' OR a.description LIKE '.$text.' )' . ' AND a.published = 1' . ' AND b.published = 1' . ' AND a.access <= '.(int) $user->get( 'aid' ) . ' AND b.access <= '.(int) $user->get( 'aid' ) . ' GROUP BY a.id' . ' ORDER BY '. $order ; $db->setQuery( $query, 0, $limit ); $rows = $db->loadObjectList(); foreach($rows as $key => $row) { $rows[$key]->href = '?pid='.$row->slug; } return $rows; } ANY help is more than what I got from HDFLV Player support. Thank you so much in advance! [attachment deleted by admin]