-
Posts
1,307 -
Joined
-
Last visited
-
Days Won
16
Everything posted by elabx
-
Mmm, I don't think this will be as straighforward, I think this is all performed in javascript: https://github.com/processwire/processwire/blob/master/wire/modules/Inputfield/InputfieldCKEditor/plugins/pwimage/plugin.js Maybe override the whole CKEditor module (copy the whole module to site/modules) and rewrite the line where the img tag is created, which i think is here: https://github.com/processwire/processwire/blob/master/wire/modules/Inputfield/InputfieldCKEditor/plugins/pwimage/plugin.js#L210
-
How to actually run banners on ProcessWire powered website
elabx replied to andchill's topic in General Support
For some simple ad banners with click measurment, what I have done is using Google Analytics as measurement of the click events, i feel it just offers A LOT more out of the box. Let's you filter by a bunch of things, present data in a lot of ways, make reports in Google Design Studio, etc. Though in all honesty, don't know how it compares to the previous solution. -
I was surprised to find out that these are not WireArray! https://github.com/processwire/processwire/blob/master/wire/core/FilenameArray.php
-
Make the user page have a page reference field that lets you create new lists. This would let you either creat all lists in the website under a central page, or with a little hook work have each list of lists living under the user. Let the page reference field include this pages through the selector that return the selectable pages. My first though would be to use another page that relates each list-game with the extra info, you could probably add a hook that automatically adds a page somwhere which holds all this extra fields. Could be something like: - User -- Lists --- List 1 (holds a page reference field to all games) ---- Game 1 (for each game in the list parent field, a page here exists, holding extra fields that can be custom for this particular user) ---- Game 2 All possible with selectors and i think the owner selectro could help here: http://processwire.com/blog/posts/processwire-3.0.95-core-updates/ Doable out of the box with the page reference fields. This are just my first thoughts, maybe someone has a more elaborate solution or sees an error in my conception.
-
Wow! Amazing educational answer, thanks a lot, this kind of conversation really helps anyone move forward, thanks for your dedication!
-
Hi! Wanted to share this and ask for opinions: I see a lot of regex approach to finding/changing links but the DOMDocument class seems very useful, is there a downside to this? Any other comment to improve this? ? (naming convention, code style?) <?php /** * Textformatter to output local links inside RTA textarea fields, as their language equivalents * by Eduardo San Miguel * * ProcessWire 2.x * Copyright (C) 2011 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class TextformatterLanguageLinks extends Textformatter implements Module { public static function getModuleInfo() { return array( 'title' => "Multilanguage links", 'version' => "100", 'summary' => "Textformatter to output local links inside RTA textarea fields, as their language equivalents", 'author' => "Eduardo San Miguel", 'requires' => array( "PHP>=5.4.0", "ProcessWire>=2.5.28" ), 'icon' => 'languages' ); } public function format(&$str) { $dom = new DOMDocument(); $dom->loadHTML($str); $tags = $dom->getElementsByTagName('a'); foreach ($tags as $tag) { $path = wire("sanitizer")->path($tag->getAttribute("href")); if($path){ $possiblePage = wire('pages')->get($path); } else{ continue; } if($possiblePage->id){ $langPageUrl = $possiblePage->localUrl(wire("user")->language); } //If empty? if($langPageUrl){ $str = str_replace($tag->getAttribute('href'), $langPageUrl, $str); } } } } Edit: Already found bugs because I wasn't sanitising the assumed path in the href attributes.
-
The $page inside the Hannah code should refer to dev_button_repeater item, so you can search where it belongs to like this: wire('pages')->get(preg_replace("for-page-",$page->name)); That should return the dev_repeater item of the iteration. Thoug don't have very clear how you are using the hannah code. Maybe like this it would work? Use the parent repeater's image if attr is data-image and no value is set. [[data attr="data-image"]] Set a custom data attribute: [[data attr="data-example" value="Something something"]]
-
<?php foreach($page->dev_repeater as $repeater) { $image_field = $repeater->image_field; foreach($repeater->dev_child_repeater as $url) { $url->hidden_field = $image_field->url; } } ?> I´m guessing something like this should be working right?
-
Yes, this should be doable! https://github.com/ryancramerdesign/ProcessHannaCode (Check PHP Usage Notes) If I understand the docs correctly, the $page variable context will be the repeater page where the image field is.
-
Is there a way to add an extra action to the ProcessPageEdit button? I tried calling $inputfieldSubmit->addActionLink() but get a weird result (image below), then I noticed that ProcessPageEdit seems to be rendering this options without the module's render methods? Getting this when adding an option through a hook to the InputfieldSubmit object of the edit form:
- 1 reply
-
- 2
-
Well now it does perfectly! But I don't know how I got yesterday to a bunch of 404 pages. If I come accross the situation again I'll let you know.
-
Hi! @Mike Rockett the documentation pages for Jumplinks seem to be down, will you upload them somewhere else again?? Then again, thanks for this awesome module. EDIT: Whoops, right here: https://jumplinks.rockett.pw/
-
How to create a copy URL Fieldype?
elabx replied to Thomas Diroll's topic in Module/Plugin Development
Sounds to me like a good option is the RuntimeMarkup module, so you can basically render whatever you want in the inputfield, and add the necessary javascript to do the whole copy-paste to clipboard. -
So you didn't integrate the shop into the PW website in the end? (I remember you were looking for a solution). What stopped you from doing it? Just curious here ? Great work!
-
Internal Server Error 500 - Strato Shared Hosting
elabx replied to AndreasWeinzierl's topic in Getting Started
Anything on the error log on site/assets/logs/error.txt? -
That looks like some hipster god stack haha
-
[SOLVED] $page->field->title doesn't want to
elabx replied to BFD Calendar's topic in API & Templates
Ar the fields set to save single pages? -
Display entries depends on having an id/item in it ...
elabx replied to August's topic in General Support
Hi August! I had a bit of a hard time understanding your post, but I think you are trying to get pages with has a page field filled, then, assuming your field is called group: $selection = $pages->find("group!=''"); It's very rare to use SQL statements in ProcessWire unless you are thriving for extreme optimizations. -
Hook: Populate field value and don't save on error
elabx replied to Susticle's topic in General Support
What if you set the hook to happen before? -
How to add a button after determined field on a page edit form?
elabx replied to Jacek's topic in Module/Plugin Development
Hook it in your in the inputfield's render's method: $this->addHookAfter('InputfieldText::render', $this, 'addButton'); In the addButton method, check for the field's name, so it doesn't render everywhere. -
[solved] Displaying Content based on "user"
elabx replied to louisstephens's topic in API & Templates
For this to happen you must be using somewhere the $user variable which is the one that refers to the user in session. I'm thinking this is what you are looking for, so when Bob is logged in, $user will refer to Bob, and when Amy is logged in, it will refer to her user: $current = $pages->find("template=secondary, page_author=$user"); -
Yes, you have to check if the page you are trying to reference exists, if not, create it through the API. For educational purposes, you can check how InputfieldPage does it. See how it iterates through the titles it receives as input, and makes decisions based on the page already existing or has to make a new one. https://github.com/processwire/processwire/blob/master/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module#L840
-
Possbile to list all options (and set current selected option)
elabx replied to louisstephens's topic in API & Templates
Use this to get all the options, iterate on it and just check if the value equals the page field value: $field = $fields->get('countries'); $all_options = $field->type->getOptions($field); Check the documentation for more useful on select options fields: https://processwire.com/api/modules/select-options-fieldtype/#outputting-selected-options-on-a-page -
You cannot delete the pages directly from javascript, you have to make a call to the server. My recommendation from what I can tell from your module, is to turn the list of checkboxes into an actual form: $out = "<form action='.' method='post'>; Remember to close the form tag and also add a button for submit! Check the boxes, click the submit button an there goes the request to the server. You then check on your execute() method for the comment input like: public function ___execute() { if(count($_POST['comment']){ foreach($_POST['comment'] as $comment){ wire('pages')->delete($comment); } } //rest of the code One difference here from what I read on your code, the wire() function which holds all the PW variables you are used to use on templates. After you delete them, the rest of your logic can stay the same, as it will only find the pages that haven't been deleted.