MainelyDesign.com Blog

Showing articles 1 - 10 (142 total)

Google Tag Manager (GTM) Not Firing Default PageView Event

Posted 2 weeks, 1 day ago | Viewed 247 times | 0 comments

We had an interesting issue here today regarding Google Tag Manager not firing the default PageView event.  Instead it was firing the /gtm.js event.  WTF?! Turns out, the system we were using was reading event: 'gtm.js'  in the GTM container snippet as a link to a javascript resource.  So, it was turning the "url" into an absolute path, like...

In PHP, how do you get __toString() Magic Method Result without calling echo?

Posted on 10/13/2017 at 01:49 pm | Viewed 449 times | 0 comments

I knew this answer at one point, then forgot it.  So, here it is for memory's sake... How can you get __toString() Magic Method Output WITHOUT using echo statement? $echoed = strval($object->property); Cheers, - Kevin Wentworth

Getting output from shell_exec() at all times

Posted on 11/14/2016 at 12:18 pm | Viewed 1,575 times | 0 comments

Sometimes shell_exec() won't output anything.  This might be because of an error or a silent success.  If you want to see the output, you can always do this: $output = shell_exec('$HOME/aaa/command 2>&1'); echo "<pre>$output</pre>";

CORS Middleware in Cakephp 3

Posted on 10/11/2016 at 09:44 pm | Viewed 1,589 times | 0 comments

I didn't end up needing this (yet) but wanted to post here for future reference.  This is CorsMiddleware for CakePHP 3: // Plugin\src\Middleware\CorsMiddleware.php namespace Plugin\Middleware; class CorsMiddleware { public function __invoke($request, $response, $next) { // Calling $next() delegates control to the *next* middleware // In your...

View Layer - Getting count of Entities in View in Cakephp 3

Posted on 06/12/2016 at 01:27 pm | Viewed 1,651 times | 0 comments

In my views I'm usually executing code depending on if a variable is empty or not.  For example, I'll fetch all the images in a gallery and only want to output the containing divs when the gallery has images.  You can't do a simple !empty() or if($img) because it will always be "true" because it will be a non-empty object (like Cake\ORM\Query...

Changing URL in beforeRedirect() in Component - Cakephp 3

Posted on 05/23/2016 at 12:21 pm | Viewed 1,714 times | 0 comments

Change the URL redirect location using beforeRedirect() in Cakephp 3 I wanted to change the redirect behavior from within a component in my Cakephp 3 application.  The old 1.3 method of returning the new $url didn't work.  Turns out that you need to use Response::location() to modify the location of the redirect.  See my code below: public...

Foundation CSS Framework Resources

Posted on 01/28/2016 at 12:30 pm | Viewed 1,857 times | 0 comments

Motion UI Classes (used for animation): https://github.com/zurb/motion-ui/blob/master/docs/classes.md

Change View File from Controller in CakePHP 3

Posted on 01/27/2016 at 10:37 am | Viewed 2,286 times | 0 comments

You can change what view.ctp file you want to use in your controller with the following line of code.  I place it at the bottom of my function definition.  Useful for having a simple admin interface or a different view template for each language.  This doesn't change the layout of your page, just the view template the controller uses when...

Loading Model/Table Anywhere in Cake3

Posted on 01/13/2016 at 03:56 pm | Viewed 2,061 times | 0 comments

I'm finally off on upgrading to CakePHP 3.0.  I'm sick of typing out CakePHP 3.0, so from now on it's just cake3.  I'm going to post about my experiences upgrading a large application to cake3. First thing: it's so easy to get access to a model... ANYWHERE (love it!) use Cake\ORM\TableRegistry; $this->Articles =...

CURL PHP 5.5 Issue on Windows (Using Twilio SDK)

Posted on 10/06/2015 at 09:29 am | Viewed 3,962 times | 0 comments

You need to install cacert.pem. http://curl.haxx.se/docs/caextract.html Thanks to: http://snippets.webaware.com.au/howto/stop-turning-off-curlopt_ssl_verifypeer-and-fix-your-php-config/ You need to add thawte premium CA to cacert.pem for Twilio http://stackoverflow.com/a/28545924/5317538

<< newer    1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9   

Meet Site Avenger - Hosted Content Management System

Powered By: Site Avenger | Site Production: Saco Design