This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get the route from URL and look at database for content to show it in view. | |
* @return ViewModel | |
*/ | |
public function routesCmsAction() | |
{ | |
$routeMatch = $this->serviceLocator->get('Application')->getMvcEvent()->getRouteMatch(); | |
$routeName = $routeMatch->getMatchedRouteName(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toggleW3(id) { | |
var toggleme = $("#" + id); | |
toggleme.css("z-index", 5); | |
if (!toggleme.hasClass("w3-show")) { | |
$("#" + id).addClass("w3-show"); | |
$("#" + id).css("z-index", "1"); | |
$("#" + id).removeClass("w3-hide"); | |
var elementId = ""; | |
$(".w3-dropdown-content").each(function (index, element) { | |
elementId = $(element).attr("id"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* first DBConfig | |
*/ | |
$dbParamsGlobal = array( | |
'hostname' => 'localhost', | |
'database' => 'somedbname', | |
'username' => 'root', | |
'password' => 'secretpasswd', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- @return(raw) ('firstenumvalue','secondenumvalue','...') | |
SELECT | |
-- cut the word 'enum' | |
SUBSTRING(COLUMN_TYPE, 5) | |
FROM | |
information_schema.COLUMNS | |
WHERE | |
TABLE_SCHEMA = 'schemaname' | |
AND TABLE_NAME = 'tablename' | |
AND COLUMN_NAME = 'columnname'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Module implements Zend\ModuleManager\Feature\ViewHelperProviderInterface | |
{ | |
public function getViewHelperConfig() | |
{ | |
return array( | |
'factories' => [ | |
'simpleAnchor' => function(\Zend\View\HelperPluginManager $hpm) { | |
$sm = $hpm->getServiceLocator(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- without DISTINCT comes false results | |
SELECT | |
sa.*, | |
sac.*, | |
COUNT(DISTINCT sagr.shop_article_group_relation_id) AS count_group_relation, | |
COUNT(DISTINCT sai.shop_article_image_id) AS count_image, | |
COUNT(DISTINCT sar.shop_article_relation_id) AS count_relation, | |
sasd.*, | |
COUNT(DISTINCT sasi.shop_article_size_item_id) AS count_size_item, | |
COUNT(DISTINCT sacomm.shop_article_comment_id) AS count_comment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class A | |
{ | |
/** | |
* | |
* @var \SomeNamespace\SomeMember | |
*/ | |
private $someMember; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$uri = $this->getRequest()->getUri(); | |
$base = sprintf('%s://%s', $uri->getScheme(), $uri->getHost()); | |
// or | |
$serverUrlHelper = $this->getServiceLocator()->get('ViewHelperManager')->get('ServerUrl'); | |
$url = $serverUrlHelper($this->url()->fromRoute('some_routename')); | |
// or in view | |
echo $this->serverUrl($this->url('some_routename')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* | |
* @param array $data | |
* @return int | |
*/ | |
public function insertSomeAndGetLastInsertValue(array $data) | |
{ | |
$insert = $this->sql->insert(); | |
$insert->values($data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Foo; | |
use Zend\Db\Adapter\Adapter; | |
use Zend\Db\Adapter\ParameterContainer; | |
class A | |
{ |
OlderNewer