-
Posts
4,956 -
Joined
-
Last visited
-
Days Won
100
Everything posted by LostKobrakai
-
You're looking for the wrong render function. Inputfield::render is the abstract function that every inputfields overwrites with it's own. What you're looking for is InputfieldWrapper::render.
-
Even though you're using "limit=1" the find() method should still return a PageArray. So you need to use "first()" on it before getting the thumbnail field. Alternatively use get() to only get the first item, which wouldn't need the "limit=1" selector. Also sorting by id might work, but actually "modified" or "created" are more descriptive.
-
// $images is a array of images, therefore first you need to get a single image $images = $child->gallery_preview_image; // Select an image out of the array $image = $images->first(); $image = $images->eq($n); $image = $images->last(); // Each image has properties and methods. With some methods you can manipulate the image // $thumb isn't different to $image besides it's pointing to another file $thumb = $image->size(600, 400); $thumb = $image->width(300); $thumb = $image->height(100); $thumb2 = $thumb->width(50); // properties work for all images $url = $image->url; $url = $thumb->url; You can chain all those commands, I just split them for the explanation.
-
The admin page does always get the id of 2 assigned, therefore this should get you there. echo $pages->get("id=2, include=all")->url;
-
Different templates-folder for different users/roles?
LostKobrakai replied to pideluxe's topic in Wishlist & Roadmap
You should be able to do this on your own. Use $config->prependTemplateFile = '_init.php'; in your config.php and try this: // _init.php // Alter from basic-page.php to basic-page-dev.php if($user->isSuperuser()){ $page->template->altFilename($page->template->name."-dev"); } -
Regarding No. 1: $data = $modules->getModuleConfigData('WireMailSmtp'); $data[$key] = $value; $modules->saveModuleConfigData('WireMailSmtp', $data); Fill in key and value yourself. It's the same for any other modules settings.
-
It's a bug, see here: https://github.com/ryancramerdesign/ProcessWire/issues/1093
-
You've essentially three options: Pack the abstract class together with both your modules. You can use the bundle module to install the two other or leave it to the user to install them independently. Looks like this as folderstructure: FrontendUser -> ( FrontendUser.module, FrontendAbstract.php, FrontendUserLogin.module, FrontendUserRegister.module) This way users can only upgrade the whole bundle via the admin interface, but I think that's not a problem here. Distribute the modules independently (FrontendUser, FrontendUserLogin, FrontendUserRegister) and require the base module with the abstract class from the subordinate ones. Duplicate the abstract class to each module.
-
could i use default language for non-English language ?
LostKobrakai replied to adrianmak's topic in Multi-Language Support
Of course. Add a new language "english" and just drop all your translation files in the default language. -
The version for the modules directory – and therefore the relevant for showing updates in the admin backend – is the module, which corresponds to the classname one sets in the settings. For example my Inputfield Chosen Select does get the version number of InputfieldChosenSelect.module, while the version of InputfieldChosenSelectMultiple.module is irrelevant (not the best way, as I could certainly edit only the last one and nobody would notice). In a processwire installation this classname is also the name of the wrapping folder inside of /site/modules/. While a base module for installing each parts and providing a "bundle" version number is certainly a good way to go I'd say you should at least use a dedicated version for each separate module. Even just to be in line with how processwire itself handles this. I've not seen version numbers in included php files that Ryan coded, which aren't modules on their own.
-
@valan Have a look at my added link in the edit.
-
This doesn't even need an instance of TemplateFile. $text = wireRenderFile("views/text", array( "id" => $page->id, "title" => $page->parent->title )); // /views/text.php echo "This page has $id and its parent title is $title"; Edit:If you're looking to provide the template as string there's this: https://github.com/ryancramerdesign/ProcessWire/blob/576a5d30153f045daa94a136a6ba981650632b26/wire/core/Functions.php#L855
-
error installing language support
LostKobrakai replied to fenderlein's topic in Multi-Language Support
Please add some basic information like the used processwire version and your php version. -
I tried to build something similar a few days ago, but fell over this line: json_decode(@file_get_contents('php://input') This does work for x-www-form-urlencoded encoded data, but it fails as soon as you want to send images, which needs the data to be encoded as multipart/form-data. So effectively you can't use PUT to update images in php, especially if you need to send additional data besides the file (authentication). Just wanted to note this here. Alternatively one can use the way that backbone.js goes. Just use GET/POST and differ not by http method, but by something like $_POST["_method"] when working with PHP as backend.
- 32 replies
-
- 1
-
- helper
- processwire
-
(and 2 more)
Tagged with:
-
Doing additional logic after saving a new page.
LostKobrakai replied to Brmm's topic in General Support
There's also this: $this->pages->addHookBefore('Pages::save', $this, "hookAutoPageName"); // to either/or $this->addHookBefore('Pages::save', $this, "hookAutoPageName"); $this->pages->addHookBefore('save', $this, "hookAutoPageName");- 23 replies
-
- 1
-
- page
- after saving
-
(and 1 more)
Tagged with:
-
Complicated Page Query (page references, etc.)
LostKobrakai replied to Jonathan Lahijani's topic in General Support
// Single company $company = $pages->get("parent=/companies/,template=company,title~=Test"); $people = $company->people->find("first_name=Joe"); // Multiple companies $companies = $pages->find("parent=/companies/,template=company,title~=Test"); $people = new PageArray(); foreach($companies as $company){ $com_people = $company->people->find("first_name=Joe"); $people->import($com_people); } $people = $people->unique(); Pagefields are only single direction, which sometimes is not the most convenient. -
FormBuilder does not offer this out of the box as every field is self contained without any connection between them (besides inputfield dependencies). But you could still use FormBuilder to build the skeleton form. To build such a thing you've two options. Either load all available options and filter them on the client side by javascript or load only the options for the first select and use ajax to dynamically fetch and fill the other inputs based on previous selections.
- 6 replies
-
- 3
-
- dependencies
- dependable fields
-
(and 1 more)
Tagged with:
-
Yep it's only built for FormBuilder to have a simple option for inputs like "Country > City > Address" selection, built from a single tree. Thought it maybe helps.
-
Can someone explain why @getbootstrap does not allow copying parts of their codesamples. Can't be that difficult.
-
Update "How-To Install or Uninstall Modules"
LostKobrakai replied to Richard Jedlička's topic in Getting Started
Sadly things do take a while sometimes because there's no fully elaborate way of handling community input for the website, yet. While the occasional reminder is nice I suggest being patient with it. -
I pushed some updates to prevent infinite loops, if a template can be his own parent, and improved the search of possible parent-template constellations.
-
Repeaters are not officially supported by inputfield dependencies.
- 20 replies
-
- 3
-
wireRenderFile does return the output of the included file. So everything you echo in test.php will be returned to $temp as string. The passed variables are only made available as copies, but they do not automatically make the function return anything.
-
Maybe the easiest way to solve this would be with some custom js logic, as your subselection needs to be in another selectfield as your saved values (which include added pages). Otherwise I'd look into other libraries as chosen is really trying to act like real selectfields.
-
While the new page is in the dropdown it should be grayed out and unselectable as it's already selected. So what's the problem with showing it? I don't think there's an easy option to to hide them as the chosen library is automatically build from a multiselect input which does not have any modifiers. I've tried to add destinct styling to new pages before and found no good way to do this.