-
Posts
806 -
Joined
-
Last visited
-
Days Won
10
Everything posted by kixe
-
In fact, these modules are very similar. That's why I did not publish my module in the Processwire module directory. small differences: I use the builtin InputfieldMarkup I don't use eval() No need to create a new field if used in another template. Simply overwrite the output template based. The basic usecase is to set the markup field and template/field based. Via string tags all pagefield values and other page properties are accessible. Any textformatter can be applied. Full Language support. For more complex calculations the output is hookable and the full PW API can be used to create the output, not only $page or $pages. Example: A page (A) has been assigned to another page (B) via a page field. I want to show some informations about (B) inside (A)
- 3 replies
-
- 7
-
- field
- calculation
-
(and 1 more)
Tagged with:
-
This fieldtype will generate any runtime markup: https://github.com/kixe/FieldtypeMarkup
- 3 replies
-
- 2
-
- field
- calculation
-
(and 1 more)
Tagged with:
-
As you know I tested the module with several different javascript based color pickers via the included custom script option. I will leave this as is. Use and modify the picker you like. Another thing is the dynamically change of the input and background color in the Textfield. This is pretty good and if I find time I will implement this.
-
@Robin S Useful textformatter in case of multiline content. If you want to hide text without linebreaks you can also use Core TextformatterMarkdownExtra:
-
@adrian Thanks for pointing on this. I added a fallback to the standard dechex() function for 64-bit systems. In the rare case that neither the BCMath extension is installed nor the system can handle 64-bit integers, the module is not installable.
-
How to create a copy URL Fieldype?
kixe replied to Thomas Diroll's topic in Module/Plugin Development
Once I made a nice Fieldtype for this. Please try out http://modules.processwire.com/modules/fieldtype-button/ -
With PW this is only possible for subdomains. $this->config->sessionCookieDomain = '.example.org'; This setting includes: example.org subdomain.example.org
-
LoginRegister Module - Hook for admin notifications
kixe replied to JayGee's topic in Modules/Plugins
Just to clarify: Usually there is only one instance/ object of ProcessWire which is the ProcessWire boot object represented by the variable $wire. ProcessWire is a child class of Wire. Assuming you are talking about all Wire objects the answer is YES and more: // Access to a wire object from inside a wire derived class: $pages = $this->wire('pages'); // Access to the current ProcessWire instance: $wire = $this->wire(); // Create new wire object inside your ready.php $this->wire('ferry', '/site/translations.php'); Read more: https://processwire.com/api/ref/wire/wire/ -
You can set flags and apply roles allowed to 'view' or 'edit' this field. $field->setRoles(string $type, $roles); // $type = 'edit' or 'view' $field->addFlag(int $flag); $field->removeFlag(int $flag); Reference: https://processwire.com/api/ref/field/ https://processwire.com/api/ref/field/set-roles/ https://processwire.com/api/ref/field/add-flag/ https://processwire.com/api/ref/field/remove-flag/
-
How do I make ProcessWire display the 404 "page not found" page?
kixe replied to ryan's topic in API & Templates
I have to correct myself. I missed a hook that triggered the 404. Everything is working as expected and as it should work. -
How do I make ProcessWire display the 404 "page not found" page?
kixe replied to ryan's topic in API & Templates
Getting wrong header if 404 is triggered inside template file. Calling a not existing page http://example.org/not/existing/page the correct http status header is sent: 404 Page Not Found The following code inside the template file renders properly page with id=27 but sends header 200 OK instead of 404 throw new Wire404Exception(); Would like to see 404. -
Tried to add an item to an array, which is a page property. The common way doesn't work. Is there a PHP expert out there who can explain that to me? Thanks. $page->prop = array('a','b','c'); $page->prop[] = 'd'; var_dump($page->prop); // output: array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" } $page->prop = array('a','b','c'); $page->prop = array_merge($page->prop, array('d')); var_dump($page->prop); // output: array(4) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" [3]=> string(1) "d" }
-
Namespace problem. Somewhere in your files (ready.php?) the namespace ProcessWire is defined. You need to remove this. Don't mix files of installations (PW 3.0.x) using namespace with non namespace installations (PW 2.7 or 2.8)
-
I tested my code and it works. Maybe there is a namespace issue. Which PW Version do you use? Did you place the code in the right file and folder?
-
Enable debug mode to get the error messages and figure out the problem. in /site/config.php $config->debug = true;
-
[SOLVED] How to display field's label on error messages?
kixe replied to PWaddict's topic in General Support
@PWaddict Thanks https://github.com/processwire/processwire/commit/79fa81d8a87a1d026d8f763021b8df191f48a4e0 -
If you need this for the backend (result available in frontend too) you can use FieldtypeMarkup for the result. Grab the code from here: https://github.com/kixe/FieldtypeMarkup Create a hook with your formula and place the code in /site/ready.php The result will be populated after saving the page. /** * https://github.com/kixe/FieldtypeMarkup * FieldypeMarkup as concat field with formula * EXAMPLE * */ $wire->addHookAfter('FieldtypeMarkup::formatValue', function($e) { $page = $e->arguments[0]; $field = $e->arguments[1]; // quick exit if ($field->name != 'result') return; if ($page->template != 'calculator') return; $value1 = $page->inputfield1; $value2 = $page->inputfield2; $value3 = $page->inputfield3; $value4 = $pages->get(12345)->inputfield1; // get value from another page $result = $value3 * ($value2 - $value3) / $value4; // formula $e->return = $result; });
-
Set up a page which just return the cookie banner, put it in an iframe and add it to the other sites. You would have to change (loosen) the x-frame options in your .htaccess file of the framed page to get this work. All-in-all not the best solution.
-
It looks like PW is searching for PHP\CustomHooksForVariations, but this class doesn't exists. Namespace settings ok?
-
@Fuzzy Place this code in /site/ready.php Create this file if it doesn't exist.
-
@Pete This thread should be appended to the support thread of ProcessSetupPageName https://processwire.com/talk/topic/8576-name-format-children/ @pppws Which PHP version doesn't work? which one works? Which module version do you use? Which ProcessWire Version?
-
Private module used in private repos for multiple sites?
kixe replied to chcs's topic in General Support
You can change the module service url in your config.php file. $config->moduleServiceURL = 'http://modules.processwire.com/export-json/'; $config->moduleServiceKey = (__NAMESPACE__ ? 'pw300' : 'pw280'); Format of the complete url: {moduleServiceURL}/{moduleClassName}/?apikey={moduleServiceKey} Example: http://modules.processwire.com/export-json/MarkupCookieConsent/?apikey=pw300 If you provide this service (json format) for your module by your own you could hook in ProcessModule::execute if ($input->get->update) { $this->addHookBefore('ProcessModule::execute', function($e) { $moduleClassName = $this->wire('sanitizer')->name($this->wire('input')->get->update); if ($moduleClassName != 'MySuperPrivateModule') return; // change service url here $this->wire('config')->moduleServiceURL = 'http://example.com/export-json/'; }); } Another solution: Symlink your module if all sites using this module are hosted on the same server. -
For security reasons, a cookie can not be set for a different domain. There may be ways to trigger this, but this could open security holes. The cookie set by this module also applies to subdomains.
-
@wbmnfktr The reason is the invalid token: https://github.com/processwire/processwire/blob/bdaf8810cbb71944820c45e0b297d0b75f1e60be/wire/core/SessionCSRF.php#L176-L191 Make sure that the session cookie is set and valid and that the current valid token is sent with the form.
-
All forms in the backend of processwire are secured against CSRF attacks by assigning them a one-time token. This will ensure that the page and the current session that generates the form is the same as the one that receives the form. E. g. The error message appears when a backend page (also Login) is open and the session has expired, or the session cookie has been deleted from the browser or could not be set in the browser.