-
Posts
654 -
Joined
-
Last visited
-
Days Won
8
Everything posted by psy
-
Module Module: RuntimeMarkup Fieldtype & Inputfield
psy replied to kongondo's topic in Modules/Plugins
@Chris Bennett ummn, not sure... went to PW Modules to get it - version 0.0.2 According to the Modules site & @kongondo's github site, I am. There are a couple of modules that do similar. Please give me the URL to the one you used ? It's important to this site that I can "do stuff" in PHP/PW before outputting the string Thanks -
Module Module: RuntimeMarkup Fieldtype & Inputfield
psy replied to kongondo's topic in Modules/Plugins
Looking for help on this one. I have a RuntimeMarkup field in a template. When I only return a string with no HTML markup, all is well. See image 1 where the RTM field is "Skills" and it's returning the title of an auto-generated FormBuilder entry with no HTML. When I try to output more info from the FormBuilder entry & format it, the page CSS loses the plot. Not only are the UiKit3 styles ignored, much of the page CSS is broken too - note the Save Edit button and the stacked-rather-than-styled fields above it. RTM CSS file is as default and all that's returned to the field is a valid string. I've even tried returning a valid HTML string with heading & paragraph tags to take FormBuilder out of the equation. The output string is: <div> <h3 class="uk-h3">Skills</h3> <div class="uk-width-3-4">some other skill</div> <div class="uk-width-1-4">65%</div> <div class="uk-width-3-4">talking under water</div> <div class="uk-width-1-4">80%</div> <div class="uk-width-3-4">Yawning</div> <div class="uk-width-1-4">100%</div> <div class="uk-width-3-4">Balloon animals</div><div class="uk-width-1-4">80%</div> </div> Actually doesn't seem to matter what HTML tags or classes I enter, as soon as I do, the page CSS breaks. Believe me, I tried lots! RuntimeMarkup is a @kongondo module Any suggestions on where and how to fix? PS: Text in the summary field comes from https://baconipsum.com/ - I like it spicy! -
@kuba2 after copying your files to the new location, did you change the $config->httpHosts array so PW knows were to look for the files?
-
@kuba2 1. yes 2. yes, after you've uploaded all the PW files to the new domain name folder When the new website URL/domain name is on the same server/web hosting account and has access to the same database, all you need to change is the site/config.php https hosts array to accept the new URL(s). Easy, peasy, lemon squeezy ? PS: either put the new URL(s) at the start of the $config->httpHosts array to give them priority or remove the old ones to prevent PW confusion
-
Yes, you can duplicate your site on a new domain. There are modules that will help you do this but I'm a bit old school and prefer to do it manually when moving PW sites. Take a copy of the database, either with the ProcessWire module, DatabaseBackups or via PhpMyAdmin and download to your PC Download all your PW files to your PC, especially site/config In your new site, create a MySQL database and make a note of the db credentials Import your database sql file via PhpMyAdmin Upload your files to the new domain Edit your site/config.php file to include the new database credentials and the http hosts to the new domain name Clear your cache, especially ProCache if you use it Should then be all good to go PS: It's important to use your original site/config.php file as it contains the password salt for the original database
-
@anderson What the amazingly talented PW dev @bernhard said is true, especially the bit about it being different to point-n-click website builders. Keep in mind that ProcessWire offers so much more on so many levels. Whether you want to get into module development or not is up to you. See the showcase for examples: 1. A landing page site of mine that used a number of custom & pro modules, including Repeater Matrix 2. A landing page site from another PW dev that used nothing but core modules
-
Yes, Bootstrap https://getbootstrap.com/, Zurb Foundation https://foundation.zurb.com/ & UiKit https://getuikit.com/ are good places to start if you're unfamiliar with responsive websites. Actually, even if you are, they can save you a lot coding time. ThemeForest is a good place to start. I often buy a license for Canvas, https://themeforest.net/item/canvas-the-multipurpose-html5-template/9228123 which is based on Bootstrap, then place all the files in site/assets and as mentioned previously, use overrides/changes in site/templates. ProcessWire uses UiKit3 as it's default responsive admin theme
-
Gotta love ProcessWire... it's so flexible. You can put stuff where it works best for you. I prefer to create a folder for my original HTML theme in site/assets. That way I know it's always going to be clean, then any changes/overrides go in site/templates. Whatever works for you ?
-
Agree. Search engines also don't like links that aren't descriptive, eg "more" or "read more", etc, for accessibility reasons. Maybe make it italic with "Learn more about ProcessWire"?
-
Hi @anderson and welcome to ProcessWire In answer to your questions: 1. Short answer is yes, if you have 10 pages of which 2 have the same layout, then you will need 9 templates. HOWEVER, I recommend you read up on "Regions" and delayed output. You can have the _main.php template with all the common elements eg the header and footer, then you only need templates for the bits that are different, eg the page body. Alternatively, you can include files such as header.php and footer.php into each page template file. 2. Yes, Modules - Site (or other tabs on that page) 3. "PageTableExtended" is an Inputfield module. Create a new field and assign it as type PageTableExtended then add it to your template(s) 4. There is a core fieldtype called "Repeater". This is not installed by default. You can install it from Modules - Core. 'Repeater' is a prerequisite of the commercial module, "ProFields" https://processwire.com/store/pro-fields/ which includes a number of fieldtypes including 'Repeater Matrix'. 5. The '/site/assets' folder is automatically created on the web server when you install ProcessWire. It's used by PW for all sorts of stuff and you can add your own files/folders if you wish. Typically you would access it with FTP or similar. It's not visible in admin area by design and a good place to store files you don't want to change
-
When creating the field, set is as not required. Then after adding it to your Events template, edit it to Required on the template. That will make it a required field for only that template.
-
Second site launch for the Australian Antarctic Division
psy replied to AAD Web Team's topic in Showcase
All good now -
https://www.naturesextract.com.au/ Nature's Extract is an Australian manufacturer of water dispersible massage oils whose target market is professional massage clinics and day spas. They've had a BigCommerce web shop for a while. They decided to add a landing page to draw more customers to their online store. The store has the same domain name with .com extension. The landing page has .com.au extension to tweak geo-location oriented searches even though the .com site in Google Web Developers (or Search Console or whatever they call it now) is set to primary location is Australia. It is also hoped the .com.au extension will appeal to the targeted human audience. The client insisted that to reinforce buyer confidence, there should be a focus on the facts that the products are Australian made and that they've been in business for 25+ years. It's a single page site that grew a bit. Modules used: BigCommerce PHP API - pulls product images, descriptions & links from the BigCommerce store via the BC REST API Email Obfuscation ProFields - Repeater Matrix JSON-LD Schema ProCache MarkupSEO MarkupSitemap Database Backups Files Editor Upgrades It also uses PWABuilder code & icon images to make it a Progressive Web App. Google Lighthouse Report results are: Have done all I can think of to make the page pleasing to Google. Now for traffic, backlinks, recommendations, social media, influencers, etc. Almost makes me nostalgic for the days when to be found on the web, you only needed a web page with relevant content, attractive graphics and good page structure...
-
Repeater containing if statement to execute HTML code after X iterations
psy replied to Michkael's topic in General Support
@Michkael Doh me! - the class to clear a row in your case needs to be on each 4th item... Recommended change: <?php $i = 1; foreach($page->Services as $Service): $image = $Service->image; $colFirst = ""; if ($i%4 == 0) $colFirst = 'col_first'; $i++; ?> With CSS class: .col_first { clear: both; } Remember to either type the above completely into your IDE or copy/paste into a text-only editor first -
Repeater containing if statement to execute HTML code after X iterations
psy replied to Michkael's topic in General Support
@Michkael Sometimes when copy/pasting directly from forum code unexpected and hidden chars end up in the output. I suspect that's what happened here. The (pure) code works but when I copy/pasted to my IDE I found a hidden char after.... "colLast" = "row" in your code. No one's fault and I'm guessing Line 144 was $i++ that failed. Also found that your code <?=colLast"?> had a weird space in it in my IDE. Best practice when copy/pasting from forum code is to paste into a text only editor before copy/pasting into your template to remove any weird, hidden chars. After that and with Bootstrap being your framework, <?=colLast?> in that place will not work for you. Bootstrap needs the row class on its own eg: <div class="row"> <div class="col-md_6"> ... </div> </div> To make it work for you, you could try adding a CSS class: .col_last { clear: both; } to ensure the next item starts on a new line below the previous three -
One Pager HTML template migration to processwire: good practices
psy replied to Michkael's topic in General Support
One of the things I love most about PW - and also find frustrating at times - is that there are so many ways to achieve the desired end result. Choosing which way to go at the start of a project can be tough. Whichever method you choose for front-end output can be done in PW -
Repeater containing if statement to execute HTML code after X iterations
psy replied to Michkael's topic in General Support
And as a 3rd option, use the PHP modulo feature: http://php.net/manual/en/language.operators.arithmetic.php 1. Set a variable, eg $i to 1 2. Iterate through your (Wire)array and add 1 to $i each time 3. At each iteration, check if $i%3 == 0 and if so, add your row html Example below selects 6 random service items and splits into 2 columns x 3 rows. For each item that returns $i%2 == 0 (2nd row item) I add the class "col_last". Add classes, html as required for your frontend theme - guessing it's Bootstrap <?php $services = $pages->get('name=services')->pgtb_services->findRandom(6); $i = 1; foreach ($services as $item) : $colLast = ""; if (($i%2) == 0) $colLast = 'col_last'; $i++; ?> <div class="col_half service <?=$colLast?> nobottommargin"> <article class=" boxFeature"> ... </article> </div> <?php endforeach; ?> -
Love my iMac and happy to know you love yours too @ryan. Biggest hurdle for me going from Windows to Mac was - really? it's that easy????
-
Your alt method sounds plausible. Will try it ?
-
Thanks @kongondo The page is created automatically by PW, not via the API when the admin clicks on the parent page -> new. I think I need to find the right conditional statement to say return if it's a new page with no required custom fields completed. Maybe instead of checking if the page has an id: if (wire('pages')->added($page)) return;
-
This should work too. (I used the method to output the month as a heading for a list of events sorted by start_date). What it does: Gets the first letter of the first child and output it, eg "A" Gets the next child and compares the first letter of its title with the previous child's title first letter If the same, it continues on If different, it outputs the new first letter <h2>Services</h2> <?php if ($page->children->count) : $children = $page->children('sort=title'); foreach ($children as $child) : $letter = substr($child->title, 0, 1); // get the first letter of the title if ($child->id == $children->first->id) : // first child ?> <h2><?=$letter?></h2> <?php else : $prevLetter = substr($child->prev->title, 0, 1);; if ( $prevLetter !== $letter) : // different first letter in title to previous sibling page ?> <h2><?=$letter?></h2> <?php endif; endif; ?> <p><?=$child->title?></p> <?php endforeach; endif; ?>
-
I have a template that is the only child of a parent template so the admin is not asked to enter a title/name. The page is automatically created and admin presented with the custom fields screen. All good so far. The page name is auto-generated with the date/time. Again all good. Problem occurs once the admin changes fields on the page. The new title and page name is a combination of: 1. Calculation of start date and end date of the event, eg 1/11/2018 to 2/11/2018 results in "2 Day " 2. Title of a page reference field, eg "Long Reining Clinic", and 3. The start date That works providing the clinic title doesn't have an ampersand in it... that results in an Error 403 Permission Denied error when editing the event. Got over that one only just and no understanding why it happens Immediate and bigger problem is that 2 pages are created: 1. First on creation of the page - unpublished with default title and no custom data 2. Second on admin update of the custom fields - often there is a conflict of page ids Below is my hook in ready.php to change the page title & name once the relevant custom fields have been entered. It's taken pretty much directly from the PW docs. The CustomFunctionDDH::clinicDays returns a string as per above, eg "2 Days " /***** Update page title for event/clinic pages */ wire()->addHookBefore('Pages::saveReady', function (HookEvent $event) { $pages = $event->object; $page = $event->arguments(0); if ($page->template != 'event') return; if (empty($page->id)) return; // doesnt work for new pages if ($page->isChanged()) { $title = CustomFunctionsDDH::clinicDays($page) . " "; $title .= $pages->get("id=" . $page->pg_clinic_type_title)->title; $page->of(false); $page->title = $title; $startDate = wire('datetime')->date('d m Y', $page->start_date); $newName = str_ireplace('---', '-', wire('sanitizer')->pageName("$title $startDate")); if ($page->name != $newName) $page->setName($newName); $page->seo_title = $title; } }); What am I doing wrong? Help appreciated Solution: Problem due to operator error/digital malfunction, ie me! Doh! BEFORE I set the page parent template Events to only accept child pages with template Event, I had added one child page with template 'basic-page'. No wonder PW got confused. Changed the parent template Events to also accept child pages with template 'basic-page', problem solved. Now though, instead of automatically going to the 'event' custom fields, the admin must enter a page title (could be aaaaa) and save. Client and I can live with that. Thank you @kongondo for your suggestions. Sometimes the obvious is staring me in the face...
-
@cb2004 ? ?
-
I arrived at ProcessWire via a different path. A few years back, two other developers and I were dissatisfied with the CMS we were using. Other two researched, tested, investigated all on the market except WordPress. We all agreed we'd rather give up than go down that road. Fortunately for me, they both agreed PW was the best and I should give it a go. Haven't looked back. Thanks @ryan, the forum team, Goran and @Stikki ?
-
Hi @thepurpleblob and welcome to ProcessWire Hrmmm, yes your question is a bit hazy and I'm not sure I fully understood it. There are lots of ways to deploy development sites to live including modules to help you through the process. It's my experience that the best way is to: back up/download a copy of the db on the development server (I always install the db backup module https://modules.processwire.com/modules/process-database-backups/) create a new database on the live server and import the db backup from the dev server zip the development files and upload to the live server update the /site/config.php file on the live server to reflect the changes in the db configuration and https hosts options That way, the dev & live server data & files (/site/config.php excepted) are identical including admin logins You may want to install https://modules.processwire.com/modules/process-wire-upgrade/ on both your dev & live servers to easily ensure they're both always on the same PW version Hope this helps