Questions tagged [php]

The tag has no usage guidance.

34 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
98 views

How to wire html template to twig extension? (Mainly `Twig\Error\SyntaxError: Unknown filter Error`)

I am going to use a Twig filter function by using Twig extension in my HTML file. I followed this guide. https://cameronspear.com/craft-cms-twig-filter-extension/ But when I run <p>{{ 123 | ...
2
votes
0answers
362 views

Autocomplete for Visual Studio Code for plugin development

How to achieve autocompletion for Craft 3 for PHP inside Visual Studio Code? I mean, what is required (like installing PHP locally, folder structure etc.) if at all possible? I assume many people who ...
2
votes
0answers
331 views

Klarna Checkout - Omnipay

I am trying to create a custom payment gateway by extending / adding it to Omnipay which is already implemented in Craft. I have used the Ogone and other plugins as base, but I cant seem to get it ...
1
vote
1answer
41 views

How to build a web page using different sections created in craft

I am a beginner in Craft. I have a Craft website. There is an HTML design with me. From admin, I divided the HTML into sections and created entries based on that. All the coding related to each ...
1
vote
0answers
52 views

Craft Commerce Adjuster API/PHP questions

I've got a module set up to add discounts based on criteria defined in a category group (handle 'productPacks') -> category (which is a "pack"). Now, everything works great for one type of pack, and ...
1
vote
1answer
45 views

PHP Login & Sessions without Craft Commerce?

I'm trying to implement this tutorial in my Craft CMS site, I've created all the files and they currently reside in public_html, but twig and the .htaccess of Craft CMS is interfering with it. Does ...
1
vote
1answer
266 views

Getting PHP Error on upgrade from 3.0.36 to 3.1

I just updated to 3.1 and I'm getting the php error: PHP Notice – yii\base\ErrorException Undefined index: settings It probably has to do with the Cheat Sheet plugin. I deleted that folder in the ...
1
vote
0answers
120 views

Extending Craft Commerce Purchasable Nav Items

I'm looking to extend Craft Commerce with a custom Purchasable. I'd like to implement this using a module if possible. I've implemented the base class for my new Purchasable and that's all good. ...
1
vote
0answers
337 views

Element API plugin: searching and working with nested objects

I’m experimenting with the Element API plugin and working with querying the tags of the assets that appear in matrix blocks in a set of entries. Essentially I’m hoping to be able to use a tag in a ...
1
vote
0answers
437 views

How can I filter with facets in algolia with nested structures?

I have a site that currently uses a structure where we have a parent entry and children under it. On the parent page we have entries that have been created with matrix blocks. The structure is as ...
1
vote
0answers
109 views

Paginate Results from Restful XML Feed

I'm beginning with Craft/Twig and am developing a plugin that gets data from a Restful XML feed, and I've successfully tested it on my template. Below, I have the working plugin code and a sample of ...
1
vote
0answers
132 views

White screen trying to install, log shows call to undefined function ctype_alpha()

I have looked through every resource I can find for this question and haven't had any luck. OS: Ubuntu 16.04 localhost successfully shows Ubuntu landing page localhost/info.php successfully shows ...
1
vote
0answers
169 views

Frontend upload asset to Matrix

I created a matrix with 1 type, 3 fields for user profile. I use front-end to upload file to documentUpload field. But I got PHP warning: array_merge(): Argument #1 is not an array message. I Google ...
1
vote
0answers
236 views

Class 'Craft\ErrorHandler' not found in YiiBase.php after new Thread-Safe PHP install

I've just upgraded PHP 7.0 on a standard Ubuntu Server 16.04 LTS distro from non-thread safe to thread safe (using Michel Phillipe Luca's instructions here: http://php.net/manual/de/pthreads....
1
vote
0answers
238 views

Error while sending QUERY packet in continuously running process

I'm using php-resque + Redis to get queues/workers into Craft, and so far I've managed to get it all running. My test worker looks something like this: <?php namespace Craft; class JobHandler { ...
1
vote
0answers
283 views

Getting type of element inside of a matrix field using plugin hook

I've been trying to deal with saving matrix fields to an external API by hooking onto the craft()->on('entries.saveEntry) function in a custom plugin I made. Matrices are nice for content authoring,...
0
votes
0answers
21 views

Inconsistency in Channel Section Type of Craft3

I'm trying to mess around the Entry URI Format and the Template trying to understand how it work. Using the News settings below, when I access the http://site.dev/news/save-our-seas, it's working fine ...
0
votes
0answers
12 views

Trying to get Git clone to run on local Map server

I have been trying to get a Git clone of my companies website running so we can make small changes locally and send it to the developer to save costs, but I can't get the website up and running. My ...
0
votes
0answers
30 views

How to save a product via PHP in Commerce 2?

I'm trying to save a new product with variants via PHP. $product = \Craft::$app->elements->createElement(\craft\commerce\elements\Product::class); $product->typeId = 1; $product->enabled =...
0
votes
0answers
36 views

Set redirect URL according to some conditions

I implemented an API and in one controller I need to open a webview for the user to enter some data from another site and then come back to my site. I am having trouble setting the redirect URL since ...
0
votes
0answers
11 views

Set the redirect url for a request from a plugin

I implemented an API for my Craft 2 site, One of the requests requires me to open a webview where the user can fill in some forms. What happens is that he enters some info from the app that will be ...
0
votes
0answers
34 views

Contact form plugin ajax submit URL not working

I am using contact form plugin for forms in my craft website. For avoiding page redirection, I followed ajax submit for the form, but it is not redirected to controller code. My form is as below:- ...
0
votes
0answers
245 views

Craft can’t connect to the database with the credentials in craft/config/db.php

I'm trying to upgrade from 2.7.10 to Craft 3. I follow the instructions/ docs to the letter, go to https://###.com/admin and am greeted with the above can't connect to database message. So far, I ...
0
votes
0answers
27 views

Undefined property: DOMElement::$tagName HTMLPurifier

I got asked to edit the content on a website but whenever I edit an article and try to save it I get the following error: Undefined property: DOMElement::$tagName (/home/user/craft/app/framework/...
0
votes
0answers
39 views

Update asset index by PHP in Craft 3

In my plugin, I need to update asset indexes because it makes new asset folders. I found this question, but the answer is for Craft 2. How do you programmatically update an asset index? It does not ...
0
votes
0answers
374 views

MacOS 10.15 Beta and CraftCMS

i'm running a macOS 10.15 Beta (to check out SwiftUI) but now i'm running into problems with craft, specifically with the php zip extension. It's PHP 7.3.5 and i can't update it, because the install ...
0
votes
0answers
38 views

Craft CMS: Goes Unresponsive

I have an issue with the Craft3, after a few requests and clicking around the whole site (front-end and CP Admin) seems to hand and lag. Also I get a popup message on Google Chrome mentioning that ...
0
votes
0answers
43 views

Install of Craft 3 on Windows server gets 404 error on admin pages

I have tried installing Craft 3 onto a Windows 2016 server a few times and I've gotten the same issue where after an install I am redirected to the Admin page and have a 404 server error. I am using ...
0
votes
0answers
19 views

Injecting filename into all templates?

I found a topic about getting the current filename for templates here: How can I make a template output its own filename? but I am curious, is there some way I can get the server to implement this ...
0
votes
0answers
24 views

Print to Console Inside Event

I created a CUSTOM PLUGIN and I have the following code: Event::on(FOO::class, FOO::EVENT_NAMED_BAR, function(Event $e) { $message = "Hello world"; // craft::error( $message ); // ...
0
votes
0answers
64 views

Emojis on Craft 3 front office

I'm making a blog. I have a wheelform comments input type that needs to be stored as utf8mb4 in the local database. My MySQL database version 5.6 is configured to utf8mb4 in the database, tables, ...
0
votes
0answers
688 views

ReflectionException since upgrading to PHP 7.2

I've today upgraded from PHP 5.6 to 7.2 so that I could upgrade to Craft 3.0. After needing to install a lot of updates, the craft server check is completely green and says everything should be fine. ...
0
votes
0answers
106 views

Problem pulling email address from admin user in plugin

Is there some difference between admin users and other users? In my plugin, I have code that grabs the email address off of a selected user and then sends an email to that user. It works fine is the ...
0
votes
0answers
157 views

PHP Warning on Asset Upload: PelInvalidDataException

I have a front-end form to upload image files, which works 100% perfectly most of the time. However, I've noticed with larger sized images, I'll get a PHP error saying: PHP warning include(...