Questions tagged [php]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
85 views

Can I capture the users intent ('Save' vs 'Save and continue editing') for craft()->on('entries.saveEntry'

I'm writing a plugin that gathers up all the assets from an entry and saves it out as a zip (along with a JSON file with information from the entry). Any advice regarding a better method is ...
4
votes
2answers
836 views

Twig Filter in Plugin/PHP?

Is it possible to access twig filters in a plugin? I want to be able to preview how text will look in a textarea using Markdown for a discussion board, it'd be awesome to use ajax to send the content ...
1
vote
1answer
191 views

Twig issue with divisibleby()

First sorry for my bad english. What i want to do: display comments on a page, one at the right one at the left. My code look like this: {% for i in 0.. NbComment %} {% if (i is divisibleby(2)) ...
2
votes
1answer
662 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(...
3
votes
1answer
440 views

Plugin Routes: Asterisk Token effect from CP Routes

I'd like to use the asterisk token functionality that is available in the CP in my plugin. This way I can have an infinite amount of 'pages' under certain routes. In the CP, it looks like myroute/* ...
2
votes
2answers
322 views

Multiple Service/Variable/Controller plugin files

I'm not sure if I missed documentation on it, but is there a method to follow when including additional plugin files for services, controllers, variables etc.? For bigger plugins it'd help to do ...
2
votes
1answer
754 views

Plugin Settings: Attribute Types, and how to receive

I have two small arrays I want to store in my plugin settings, though I'm stuck at what the AttributeType:: should be, as well as how to retrieve the actual values. The arrays I want to store look ...
1
vote
1answer
96 views

Update Plugin's config.php

Is it possible to update the config.php file in a plugin outside of manually opening and adjusting the array? I'm hoping there's a way I can have a certain user group be able to change the array ...
2
votes
1answer
1k views

Get _POST from Select element in Form

I'm trying to get the _POST data for my form in a plugin, and for whatever reason am unable to get the selected option from a select tag: <form class="parseResults" action="actions/MyPlugin/...
2
votes
1answer
334 views

Update entry.body from Plugin

I'd like to run the entry.body content through some PHP functions before the template outputs it, there probably two approaches to this: Create a twig function via Plug (if possible) and use that in ...
1
vote
1answer
1k views

Asset uploads failing on new installation of Craft CMS

New (local) installation of Craft on Mac OSX Yosemite, working well except uploading an asset doesn't complete. The progress bar hangs and the spinner never stops spinning. Craft index.php is located ...
4
votes
2answers
11k views

Display a copyright year (or range)

I have an old php code in the footer of my site like below. Will like to convert that to twig (which I suspect will be cleaner). I don't know a lick of php hence my question here. <p> <? ...
0
votes
1answer
49 views

what's the steps can i follow to develop module for send notification from CMS OP to windows phone application? [closed]

i want to develop a windows phone application and receive notification from my CMS opencart So to send notification from my CMS, i must develop a module ! what's the steps can i follow to develop ...
9
votes
2answers
800 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 ...
1
vote
2answers
2k views

How to install cURL on Ubuntu 14.04 to run Craft CMS?

I'm in the process of installing Craft on my Ubuntu 14.04 server and ran into an issue. When I run the installer at http://example.com/admin, I get the "Can't run Craft" error message: Craft ...
2
votes
2answers
238 views

how to access to event object propereties

I want to access for particular information which is contained in event object. public function init() { parent::init(); craft()->on('entries.saveEntry', function(Event $event) { ...
4
votes
1answer
294 views

Setting arbitrary PHP constants in index.php

I was looking for a way to set arbitrary PHP constants in the index.php that could then be accessed within templates. This is particularly useful if you have more than one index/domain pulling ...
2
votes
1answer
189 views

Is there a very very basic example of simply outputting PHP with a plugin to Twig?

For arguments sake let's say I wanted a plugin that is a basic output: <?php echo '<p>Hello World</p>'; ?> So all I am wanting to output is that, and I want that output to be ...
2
votes
1answer
262 views

Plugins page inside CP Settings not working

I get an error when trying to access CP/Settings/Plugins: Fatal error: Class 'Craft\PluginVariable' not found in folderpath/craft/app/variables/PluginsVariable.php on line 47 Any Ideas?
7
votes
3answers
992 views

Session Cleanup in Craft

Just had an e-commerce site go down due to Craft's custom way of handling Sessions. The session directory never gets cleaned up, causing the sessions folder to be littered with tens to hundreds of ...
1
vote
1answer
480 views

Craft not Downloading Auto Update - HttpException on OS X PHP56

I have a development system running OS X / nginx / php-fpm 5.6 and I've pulled down a version of my site from my git repository. The site is currently running an out of date version of craft, however ...
1
vote
1answer
415 views

PHP error after installation

After I install craft, I am getting the following error when trying to load the website including the admin page: PHP Stack trace: PHP 1. {main}() \aspace\index.php:0 PHP 2. require_once() \...
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 ...
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.
3
votes
1answer
696 views

How do you set a users group?

I am using the UserModel to create a user, and then injecting that into the User API service as is instructed in the documentation. The only thing I am not seeing is how to set the group. I looked ...
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?
3
votes
1answer
146 views

Tag relations not saving

Hello kind helper folk, I'm working with Simple Craft XML Import, which has a handful of older code in it. I've managed to get through most of it to the very end. The last thing it does is saves ...
3
votes
3answers
2k views

Can't get Craft running on a remote server

I have a Craft site that works great locally, but I can't get it running on a staging server. The virtual host is working and when I remove code from index.php in html it runs perfectly. Here is the ...
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 ...

1 2 3 4
5