Jump to content

LostKobrakai

PW-Moderators
  • Posts

    4,956
  • Joined

  • Last visited

  • Days Won

    100

Everything posted by LostKobrakai

  1. 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.
  2. 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.
  3. // $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.
  4. 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;
  5. 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"); }
  6. 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.
  7. It's a bug, see here: https://github.com/ryancramerdesign/ProcessWire/issues/1093
  8. 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.
  9. Of course. Add a new language "english" and just drop all your translation files in the default language.
  10. 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.
  11. @valan Have a look at my added link in the edit.
  12. 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
  13. Please add some basic information like the used processwire version and your php version.
  14. 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.
  15. 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");
  16. // 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.
  17. 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.
  18. 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.
  19. Can someone explain why @getbootstrap does not allow copying parts of their codesamples. Can't be that difficult.

  20. 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.
  21. 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.
  22. 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.
  23. 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.
  24. 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.
×
×
  • Create New...