ваяс
Все чикан-пикан
В этом, ты прав как никогдаМожно закручивать 1 криво и получать 100, но для этого вообще не надо учиться его закручивать, надо учиться как получить за это 100, это совершенно разные навыки.
![Smile :) :)](/talk/styles/default/xenforo/smilies/smile.png)
В этом, ты прав как никогдаМожно закручивать 1 криво и получать 100, но для этого вообще не надо учиться его закручивать, надо учиться как получить за это 100, это совершенно разные навыки.
мне кажется что ты придаешь слову слишком большой смысл.... в этом слове сокрыто всеголишь слово interface..Но в программинге я далеко не мастер. Я новичок ещё, я многово не знаю. Некоторые мне кажутся вообще бессмысленными, например полиморфизм, а все дело в том что я не понимаю его сути, но преимущество его огромно.
//есть автомобиль
interface Car { function go(); }
// конкретная машина
class Porsche implements Car { function go() {
// прикрутили
} }
// учимся ездить на машине
function drive(Car $car) { $car->go(); }
$porsche = new Porsche();
// ПОЛИМОРИЗМ
drive($porsche);
phpBB, vBulletin, Joomla, Drupal, WordPress, MODx, eCommerce решения и т.д. - это и есть PHP, сегодня это почему-то "говнокод".
это действительно говнокод.
Мне кажется, что достаточно неплохо. Примеры кода:А про пхпбб и джумлы - ну так именно поэтому сложилось устойчивое мнение "php=говнокод", кого ты этим удивить собрался?
<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* This models supports retrieving lists of newsfeed categories.
*
* @package Joomla.Site
* @subpackage com_newsfeeds
* @since 1.6
*/
class NewsfeedsModelCategories extends JModelList
{
/**
* Model context string.
*
* @var string
*/
public $_context = 'com_newsfeeds.categories';
/**
* The category context (allows other extensions to derived from this model).
*
* @var string
*/
protected $_extension = 'com_newsfeeds';
private $_parent = null;
private $_items = null;
/**
* Method to auto-populate the model state.
*
* Note. Calling getState in this method will result in recursion.
*
* @since 1.6
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
$this->setState('filter.extension', $this->_extension);
// Get the parent id if defined.
$parentId = $app->input->getInt('id');
$this->setState('filter.parentId', $parentId);
$params = $app->getParams();
$this->setState('params', $params);
$this->setState('filter.published', 1);
$this->setState('filter.access', true);
}
/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string $id A prefix for the store id.
*
* @return string A store id.
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.extension');
$id .= ':'.$this->getState('filter.published');
$id .= ':'.$this->getState('filter.access');
$id .= ':'.$this->getState('filter.parentId');
return parent::getStoreId($id);
}
/**
* redefine the function an add some properties to make the styling more easy
*
* @return mixed An array of data items on success, false on failure.
*/
public function getItems()
{
if (!count($this->_items))
{
$app = JFactory::getApplication();
$menu = $app->getMenu();
$active = $menu->getActive();
$params = new JRegistry;
if ($active)
{
$params->loadString($active->params);
}
$options = array();
$options['countItems'] = $params->get('show_cat_items_cat', 1) || !$params->get('show_empty_categories_cat', 0);
$categories = JCategories::getInstance('Newsfeeds', $options);
$this->_parent = $categories->get($this->getState('filter.parentId', 'root'));
if (is_object($this->_parent))
{
$this->_items = $this->_parent->getChildren();
} else {
$this->_items = false;
}
}
return $this->_items;
}
public function getParent()
{
if (!is_object($this->_parent))
{
$this->getItems();
}
return $this->_parent;
}
}
<?php
/**
* @package Joomla.Site
* @subpackage com_newsfeeds
*
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Newsfeeds Component Controller
*
* @package Joomla.Site
* @subpackage com_newsfeeds
* @since 1.5
*/
class NewsfeedsController extends JControllerLegacy
{
/**
* Method to show a newsfeeds view
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
$cachable = true;
// Set the default view name and format from the Request.
$vName = $this->input->get('view', 'categories');
$this->input->set('view', $vName);
$user = JFactory::getUser();
if ($user->get('id') || ($this->input->getMethod() == 'POST' && $vName = 'category' ))
{
$cachable = false;
}
$safeurlparams = array('id' => 'INT', 'limit' => 'UINT', 'limitstart' => 'UINT', 'filter_order' => 'CMD', 'filter_order_Dir' => 'CMD', 'lang' => 'CMD');
parent::display($cachable, $safeurlparams);
}
}
Наверно вы правы )ваяс
мне кажется что ты придаешь слову слишком большой смысл.... в этом слове сокрыто всего лишь слово interface..
public function getParent()
{
if (!is_object($this->_parent))
{
$this->getItems();
}
return $this->_parent;
}
public function getListQuery( Template $template = null, User $account = null )
{
$qb = $this->createQueryBuilder('p');
$qb->select('p','t')
->where( 'p.deleted = :deleted' )->setParameter( ':deleted', 0 );
if ( $template ) {
$qb->andWhere( 'p.template = :template' )->setParameter( ':template', $template );
}
if ( $account ) {
$qb->innerJoin('p.template','t');
$qb->andWhere( 't.account = :account' )->setParameter( ':account', $account );
}
return $qb->getQuery();
}
Ну надо же чем-то занять пользователей ZF2я вообще не понимаю как пользоваться второй доктриной.
Собственно вот и всё... О том и топик... О том и мнение ТС...оверинжиниринг щас в моде