Leaderboard
Popular Content
Showing content with the highest reputation on 04/13/2020 in all areas
-
Yes, it's the styling CKEditor applies to all dropdowns - the Format and Style dropdowns are the same. I don't want to override the CKEditor defaults because the desired width for the dropdown will probably vary from person to person, but Adrian's solution is a good one. If you want to style the items (font size, etc) within any of the CKEditor dropdowns you can add custom CSS to /site/modules/InputfieldCKEditor/contents.css. For example, I don't like the "preview" styling added to items in the Format and Styles dropdown so I have this custom CSS: .cke_panel_list .cke_panel_listItem a * { font-family:sans-serif, Arial, Verdana, "Trebuchet MS"; color:#333; font-weight:normal; font-style:normal; text-transform:none; letter-spacing:0; font-size:14px; padding:0; margin:0; }3 points
-
Hello all, sharing my new module FieldtypeImageReference. It provides a configurable input field for choosing any type of image from selectable sources. Sources can be: a predefined folder in site/templates/ and/or a page (and optionally its children) and/or the page being edited and/or any page on the site CAUTION: this module is under development and not quite yet in a production-ready state. So please test it carefully. UPDATE: the new version v2.0.0 introduces a breaking change due to renaming the module. If you have an older version already installed, you need to uninstall it and install the latest master version. Module and full description can be found on github https://github.com/gebeer/FieldtypeImageReference Install from URL: https://github.com/gebeer/FieldtypeImageReference/archive/master.zip Read on for features and use cases. Features Images can be loaded from a folder inside site/templates/ or site/assets Images in that folder can be uploaded and deleted from within the inputfield Images can be loaded from other pages defined in the field settings Images can be organized into categories. Child pages of the main 'image source page' serve as categories mages can be loaded from any page on the site From the API side, images can be manipulated like native ProcessWire images (resizing, cropping etc.), even the images from a folder Image thumbnails are loaded into inputfield by ajax on demand Source images on other pages can be edited from within this field. Markup of SVG images can be rendered inline with `echo $image->svgcontent` Image names are fully searchable through the API $pages->find('fieldname.filename=xyz.png'); $pages->find('fieldname.filename%=xy.png'); Accidental image deletion is prevented. When you want to delete an image from one of the pages that hold your site-wide images, the module searches all pages that use that image. If any page contains a reference to the image you are trying to delete, deletion will be prevented. You will get an error message with links to help you edit those pages and remove references there before you can finally delete the image. This field type can be used with marcrura's Settings Factory module to store images on settings pages, which was not possible with other image field types When to use ? If you want to let editors choose an image from a set of images that is being used site-wide. Ideal for images that are being re-used across the site (e.g. icons, but not limited to that). Other than the native ProcessWire images field, the images here are not stored per page. Only references to images that live on other pages or inside a folder are stored. This has several advantages: one central place to organize images when images change, you only have to update them in one place. All references will be updated, too. (Provided the name of the image that has changed stays the same) Installation and setup instructions can be found on github. Here's how the input field looks like in the page editor: If you like to give it a try, I'm happy to hear your comments or suggestions for improvement. Install from URL: https://github.com/gebeer/FieldtypeImageReference/archive/master.zip Eventually this will go in the module directory, too. But it needs some more testing before I submit it. So I'd really appreciate your assistance. Thanks to all who contributed their feedback and suggestions which made this module what it is now.1 point
-
Hmm - I don't get that error. What arguments are being supplied? BTW, a better way of finding the host page: $bkgPageId = str_replace('for-page-', '', $page->parent->name); $bkgPage = wire()->pages->get("id=$bkgPageId");1 point
-
Hi @Wanze, I would also like to know if there is any way to improve the way the sitemap gets generated and the way the frontend its affected in the process. My website have a few thousands of pages and growing rapidly. with a really powerful server, and constant changes , the sitemap refreshes every hour. 1. Do you think you can build the sitemap.xml in a less resource intensive way? 2. For bigger websites with more than 50k pages probably websites will need a sitemapindex and a way to keep the sitemap in this limits. According to a quick google search the Sitemaps should be no larger than 50MB (52,428,800 bytes) and can contain a maximum of 50,000 URLs. Thanks!1 point
-
Not sure ? $pages->find("template=product, has_parent=123, r_produkty_image.count>0"); This should find all your pages and images... Where product is the template of the pages that you want to find and 123 is the id of your Produkty page. Does that help?1 point
-
Hi @HerTha, What kind of control do you need exactly? Hidden pages are not excluded from the sitemap by default. Currently, you can either include/exclude hidden pages via SeoMaestro field. Or you can use the following hook to alter sitemap items programatically: https://github.com/wanze/SeoMaestro#___sitemapitems Cheers1 point
-
As I said, that code is in my context - i.e. with my field names. You will need to change those to suit your context. The field 'comment' is on the host page (outside the repeater) - just a plain text field for the cache. rentalAdjustmentPage is my trigger field inside the repeater (a page select field).1 point
-
Hi @Ivan Gretsky The code I gonna paste here is a copy/paste from other work so there might be glitches. And you should use your own fieldnames etc. What you can do is: Create a template and template file for RSS name it rss. Template not ending with slash. (Name a the page that uses this template should end with .rss In the template file something like: <?php namespace ProcessWire; use DomDocument; use DOMElement; use DateTime; header('Content-Type: application/xml; charset=utf-8', true); date_default_timezone_set("Europe/Amsterdam"); setlocale(LC_MONETARY, 'nl_NL'); /** @var \DateTime */ $date = new DateTime('today midnight'); $items = $pages->find("YOUR SEARCH SELECTOR DON'T FORGET TO SET LIMIT"); /** * Start XML Object * * @var DOMDocument */ $dom = new DOMDocument("1.0", "UTF-8"); $root = $dom->appendChild($dom->createElement("rss")); $root->setAttribute("version","2.0"); $root->setAttribute("xmlns:dc","http://purl.org/dc/elements/1.1/"); $root->setAttribute("xmlns:content","http://purl.org/rss/1.0/modules/content/"); $root->setAttribute("xmlns:atom","http://www.w3.org/2005/Atom"); $link = $dom->createElement("atom:link"); $link->setAttribute("href", $page->httpUrl()); $link->setAttribute("rel","self"); $link->setAttribute("type","application/rss+xml"); $channel = $root->appendChild($dom->createElement("channel")); $channel->appendChild($link); $channel->appendChild($dom->createElement("title", $page->title)); $channel->appendChild($dom->createElement("description", $page->description)); $channel->appendChild($dom->createElement("link", $page->httpUrl)); $channel->appendChild($dom->createElement("language", "nl")); $channel->appendChild($dom->createElement("lastBuildDate", $date->format(DateTime::RFC2822))); $channel->appendChild($dom->createElement("generator", "DomDocument, ProcessWire")); foreach ($items as $item) { $dateInt = (int) $item->getUnformatted("date_start"); if (!$dateInt) $dateInt = (int) $item->modified; /** @var DateTime $date */ $date = new DateTime(date("Y-m-d", $dateInt)); /** @var DOMElement $parent */ $itemParent = $dom->createElement("item"); // Plain tags $elements = array( $dom->createElement("title", $item->title), $dom->createElement("description", htmlspecialchars($item->description)), $dom->createElement("link", $item->httpUrl()), ); // For closure $image = $images->first(); $image = $image->size(600, round(600 * 9 / 16)); $mime = $image->ext === 'jpg' ? "image/jpeg" : "image/png"; $enclosure = $dom->createElement("enclosure"); $enclosure->setAttribute('url', $image->httpUrl()); $enclosure->setAttribute('type', $mime); $enclosure->setAttribute('length', $image->filesize); $elements[] = $enclosure; foreach ($elements as $element) $itemParent->appendChild($element); $channel->appendChild($itemParent); } echo $dom->saveXML(); When you want to place the RSS in the root you could hide it for non superusers: /** * Hide RSS page * * Hide RSS page int pagelist for NON superusers * */ $wire->addHookBefore("ProcessPageList::find", function (HookEvent $event) { /** @var User $user */ $user = $this->wire("user"); if ($user->isSuperuser()) return; /** @var Page $page */ $page = $event->arguments(1); /** @var string $baseSelector */ $baseSelector = $event->arguments(0); $selector = $baseSelector . ", template!=rss"; $event->arguments(0, $selector); }); Hope this could be a good starting point for you.1 point
-
@jploch: Work in progress report Firstly, if you set the attrs in $(document).ready then the repeater needs to be permanently open. Otherwise you need to detect the opening event and then set them. Secondly, you need to set separate attrs for each repeater item. Thirdly, I can't get AJAX working properly in PW to update from the changed repeater inputfields. So I have done a hack to use a hidden field outside the repeater to hold a cached value. Unfortunately, because this needs to serve more than one repeater item, it needs to be prefixed so that only the relevant repeater gets updated. I'd be grateful for any improvements on this approach!! The code I have (in my context, with 'comment' as the cache field) is : In the js for the runtimeMarkup field (runtime_markup_note): $(document).ready(function () { $("[id^='Inputfield_rentalAdjustmentPage_repeater']").each(function (index, element) { var id = $(element).attr("id"); var target = id.replace('Inputfield_rentalAdjustmentPage_repeater', '#wrap_Inputfield_runtime_markup_note_repeater'); var cachePrefix= id.replace('Inputfield_rentalAdjustmentPage_repeater', ''); $(element).attr('data-action', 'form-update'); $(element).attr('data-cache', '#Inputfield_comment'); $(element).attr("data-cache-prefix", cachePrefix + ':'); $(element).attr('data-update-target', target); }); }); In the php for the same field: $pageId = $page->id; $adjPageId = $page->rentalAdjustmentPage; $adjParentTitle = $page->parent->title; $bkgPage = wire()->pages->get("title=$adjParentTitle"); $adjTypeId = $bkgPage->comment; if (strpos($adjTypeId, $pageId) == 0) { $adjTypeId = str_replace($pageId . ':', '', $adjTypeId); } $out = wire()->pages->get("id=$adjTypeId")->summary; if ($out) { echo $out; } else { echo wire()->pages->get("id=$adjPageId")->summary; } The php is especially clunky and it would be better to get the host page via the for-page url segment, I think.1 point
-
oh yeah yo u are right i tried finding difficult solution to a simple problem sorry ill mark this as solved1 point
-
Hello, if i understand right, this should solve your problem; if($page->hasChildren()) { // code for page with children } else { // code for page without children }1 point
-
@MarkE - there might be other ways, but what I do is use AOS's ability to add JS to the admin and use this: .cke_combopanel__hannadropdown { width:400px !important; min-height: 250px !important; }1 point
-
https://www.sonrisestable.com/ This is one of my personal sites, but I've been using PW for client sites for a couple years now - a recovering Joomla user. ? That site uses UIKit CSS framework. I like ProjectSeven's menus for their ease of use. Ecwid is the ecommerce on the site. I'd appreciate any feedback/suggestions. I'm going to add the blog/article categories as a submenu under articles, when I get a chance.1 point
-
Regarding customer's private data: any data which is directly related to (i.e. "required by") the order should be considered as "must have" because legally speaking there is a contract between the seller and the buyer, and the customer cannot ask the shop-owner to delete such data from the system. However, "ordinary user" data – which is not related to a particular order – should only be stored if the customer explicitly agrees to it, and such data should be deletable without breaking the integrity of any order's data.1 point
-
1 point
-
Did you know you can probably do $page->parents->count() to get the depth from the homepage? The other scenarios are a bit trickier of course. I think that you probably don't need to have a hidden fieldwork storing this unless you were having dozens of comments deep in your scenario. Even then it's reasonably cheap resource wise. I would instead make savings by caching the comment output using MarkupCache whenever a new comment is made - that way people just viewing the comments don't incur any overhead, plus you can cache whether or not a reply button exists at a certain depth for your threaded comments.1 point