Questions tagged [php]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
14
votes
2answers
13k views

Can we use PHP in our templates instead of Twig?

Is it possible to use strait PHP in our templates along side of Twig and or instead of Twig? If so how does one go about it?
9
votes
2answers
816 views

Update Asset Index in Batches

I have 80,000+ files on S3 that need to be added to Craft. The Update Asset Indexes works, but takes over 24 hours and cannot be interrupted. Does anybody have a way to programmatically index assets ...
4
votes
1answer
2k views

Fatal error: Allowed memory size of 134mb exhausted

I have a template in my control panel (technically a plugin, but it's just one template) which is running out of memory: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to ...
4
votes
1answer
696 views

Include a PHP resource within a Plugin

I'm trying to include a PHP file (BrowserDetection) within my plugin. I've tried this: Craft::import('plugins.myPlugin.resources.php.BrowserDetection'); Which doesn't return any errors, but also ...
11
votes
1answer
2k views

Is there a quick way to check a server for Craft's minimum requirements?

Is there a quick way (or some sort of wizard) that can be run on a server in order to establish whether it fulfils Craft's minimum requirements without uploading all of the Craft files? Finding out ...
3
votes
1answer
8k views

Variable variables in Twig

I'd like to create a variable from another variable. What I got right now is something like this: {% set language = fr %} {% if language == "en" %} {% set fooAddress = en_foobar.globalAddress %} ...
6
votes
1answer
336 views

Existing website written in PHP Zend Framework

I manage our corporate marketing website, which is written in PHP and the Zend Framework and is hosted on LAMP servers. I've been tasked with moving the website to a CMS so other folks on the ...
2
votes
2answers
1k views

Craft with the PHP Built-in server?

With PHP 5.4+ we get a built-in webserver, http://php.net/manual/en/features.commandline.webserver.php Has anyone had luck setting this up with Craft? It seems like it could be pretty straightforward,...
2
votes
1answer
100 views

Security test generated large compiled_templates directory, site outage

We just moved an installation of one of our sites to a new server. Previously, it was on a machine where the versions of Ubuntu / PHP prevented us from upgrading the Craft core version from 2.3.x to 2....
2
votes
1answer
669 views

Dynamic routing via plugin with special characters

After learning how to use dynamic routing in MyPluginPlugin.php, I quickly ran into the issue of if the URL has special characters from url_encode: public function registerSiteRoutes() { return array(...
2
votes
2answers
594 views

Stub out the global craft() object for PHPUnit tests

As best I can tell, the 'mockBuilder' function is exactly what I want, and based on other examples, should work. Am I missing something? How can I stub out the global craft() object? under test: &...
2
votes
1answer
607 views

How to add to arrays in models?

I have a model that contains a bunch of storage arrays where I collect results from various services I have written. class Shipper_ResultsModel extends BaseModel { shipping categories for debugging ...
1
vote
1answer
15k views

“PHP Warning: var_export does not handle circular references” when devMode = true

When devMode is true, both the front end and admin of my site give me the PHP warning: "var_export does not handle circular references". I've tried disabling plugins, with no luck.
1
vote
1answer
919 views

Get Groups from User in plugin

Wondering if I can get user groups directly after retrieving the user via craft()->users->getUserById($id), or if i need to use craft()->userGroups->getGroupsByUserId($id) also? As of ...
1
vote
2answers
844 views

Adding php.ini file to root crashes site

My client's site is on name.com and in order to change the upload limit, I think i need to place a php.ini file in the web root. But Craft crashes when I add it. The site is fine when I remove it. ...
0
votes
2answers
280 views

PHP error after one click update [closed]

I updated Craft to version 2.6.2798. Since then I'm getting a PHP error: Parse error: syntax error, unexpected '[' in /craft/app/fieldtypes/BaseElementFieldType.php on line 428 PHP version on the ...