-
Posts
733 -
Joined
-
Last visited
-
Days Won
9
Everything posted by SamC
-
Template associated to an _include.php page: possible???
SamC replied to ARG's topic in Getting Started
I do something like this, see the 'includes' and 'views' folders. I find it easier structured like this but you can do it any way you like I set templates to 'main' in the alternate template section: ...then once you've created a page using the 'about' template (created in the admin), when you visit 'site.com/about', main is used to output the contents of 'views/about.php' and a couple of includes: // main.php <?php namespace ProcessWire; ?> <html> <head></head> <body> <?php include("./includes/_header" . ".php"); ?> <?php include("./views/{$page->template->name}" . ".php"); ?> <?php include("./includes/_footer" . ".php"); ?> </body> </html> I never got used to the delayed output. I like the simplicity of this approach. This is just one of the many ways you can do things in PW, experiment, have fun hope this helps. -
Children are sorted by sidebar?! What kind of PW sorcery is this? Glad you got it sorted, and welcome to the forum @csaba
-
Hi @AlyxGD you can PM me if you like. I'd need to know the full details to decide whether it's something I can help with. I'm in the UK, can do email, possibly phone depending on where you ar (I can't see a location on your profile).
-
Maybe not the best I concur. Wow. I missed that totally. Feeling stupid, but that's life! Thanks @LostKobrakai
-
Ok, so after revisiting my totally custom site in order to make some changes, I realise the hard way that my code made sense at the time. It's complex, 50% modular and a bit of a nightmare. So I'm redoing it with a framework. I saw Bulma and gave that a whirl locally and quite liked it, makes a lot of repetitive things very quick to get going. However, there is one problem for me in the framework, the need to add classes to headers in order to render them, as, believe it or not, headers! http://bulma.io/documentation/elements/title/ So I've got my RTE, add some content, the usual stuff: <h2>Sub header</h2> <p>This is a paragraph where I happily type away in the RTE then click save not worrying about class names or anything.</p> Then realise that I have literally no easy way of styling these headers. As a default, these will both look like paragraph text unless you do the following: <h2 class="title is-2")>Sub header</h2> <p>This is a paragraph where I happily type away in the RTE then click save not worrying about class names or anything.</p> <h2 class="title is-2")>Another sub header</h2> <p>This is a paragraph where I happily type away in the RTE then click save not worrying about class names or anything.</p> Now there's no way in hell I'm going to add a class every time I want a h2 in the RTE (i.e. from the styles dropdown). And in my template, the field is simply rendered thus: <?php namespace ProcessWire; ?> <section class="section"> <div class="container"> <?php echo $page->body; ?> </div> </section> Is there a sensible way of handling this? I mean do people not use an RTE in this way? Do they separate all content into header/body fields in order to be able to use classes more easily in their templates? A news article for example would have multiple headers and paragraphs, a case for a repeater perhaps? Any advice is appreciated, thanks.
-
@AlyxGD I'd go with the suggestion above. If it's something I can help with, I'm on the lookout for extra work at the moment.
-
Hi @AlyxGD and welcome to the forum. Do you need to install it if you're making changes to an existing site? And if so, what have you tried so far?
-
So, the quest to become proficient at one the skills I should have learned years ago continues. And it gets boring at times. So I went looking for IoT/robotics and stumbled across this: https://cylonjs.com/documentation/platforms/sphero/ Computer (check) Sphero (check) JS skills (hmmm kind of) Can't wait though, to write some code and see something actually move is like magic to me. Anyway, thought I'd share.
-
Freakin awesome song. Love the Johnny Cash version too. When coding, my only music is the drone of the tutors' voice in the non-stop tutorials I seem to be doing... thanks JavaScript. When reading (JS books of course atm) I need quiet. When I'm in the car however, all hell breaks loose to free me from the constant brain melt of learning programming! ...and when I finally calm down, something more like this:
-
I've been hard working on JavaScript and things are finally starting to fall into place. I've missed the PW forum though so I thought I'd swing by and share this. Kept me amused for awhile, enjoy
-
Can I add to this, in case anyone is using an RME babyface and linux, and has no sound. The solution for me was to boot into linux, unplug the USB from the babyface, plug it back in whilst holding down select and recall buttons. This puts the device into class compliant mode, which can then be seen in (in my case) Ubuntu Budgie. I'm on linux right now, with sound!
-
Thanks @lecrackffm I bought this course a while ago on a deal for about £10, only about halfway through but so far it's been excellent Working through another one at the moment but definitely going back to the weird parts afterwards!
-
Nice, thanks @lecrackffm I'm still learning vanilla JS and think these will be great for me. It's been a LONG journey for me to get into it but I think I'm finally making headway, getting deeper into objects, closures etc. moving onto prototype next. I think it's fair to say I'm as good as the amount of effort I've put in. Doing about an hour a day now, really need my JS to be as good as my CSS/HTML to be a much better all rounder. PHP is something I'm not brilliant with either but I can live with that thanks to the PW API
-
Experiences with building (payed) membership Sites?
SamC replied to Chris's topic in Getting Started
This looks really interesting. Thanks @LostKobrakai for sharing. -
Thanks @rick I always like to read how other people approach a problem as it gives me more options when said problem becomes one of mine!
-
How did I miss this? Here's me logging into cpanel > phpmyadmin > export DB > unchecking cache data... blaaaaaaah! Must give this a try. Thanks @Ivan Gretsky.
-
@rick I forgot to ask, how do you handle '/home/policy/'? Does 'policy' have a template file to match the one set in the admin? I set '/misc/' to published but hidden so this page throws a 404. I have no template file for my 'misc-pages' template. All that was supposed to be for was a parent for listing child pages. i.e. I have: /misc/faq/ /misc/privacy-policy/ /misc/cookie-policy/ /misc/terms-and-conditions/ ...with templates set up like this: /misc-pages/basic-page/ If that makes sense.
-
Thanks @Zeka Ok, so the reveal shows, but the hide button doesn't seem to toggle the class now. Think I need to dig in at what closest & siblings are doing here. I updated the pen to show what I'm talking about.
-
I'm still learning vanilla JS at the moment but trying out a bit of jQuery here and there. This has me stumped though: I don't know how to target only the element that's clicked on. Of course, when clicking now, both overlays pop up because a class 'show' is added to any element with class 'card-reveal' i.e. to both of them. Probably pretty simple for someone with more experience but I'm finding this awkward to search for a solution online. Any help is appreciated, thanks.
-
This works as expected: /** * mystyles.js */ CKEDITOR.stylesSet.add( 'customstyles', [ { name: 'Generic List', element: 'ul', attributes: { 'class': 'generic-list'} }, { name: 'Inline Code', element: 'code' }, { name: 'Inline Quotation', element: 'q' }, { name: 'Left Aligned Photo', element: 'img', attributes: { 'class': 'align_left' } }, { name: 'Right Aligned Photo', element: 'img', attributes: { 'class': 'align_right' } }, { name: 'Centered Photo', element: 'img', attributes: { 'class': 'align_center' } }, { name: 'Small', element: 'small' }, { name: 'Deleted Text', element: 'del' }, { name: 'Cited Work', element: 'cite' } ] ); Just didn't use 'mystyles'... Still don't know why the 'mystyles' didn't work, but I can live with this https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/modules/Inputfield/InputfieldCKEditor/README.md#custom-editor-js-styles-set "The term mystyles is just something we made up, and you may use whatever keyword you like (as long as it's not mystyles!), but note you will have to use that same keyword in the file itself. In our example below, you will see where we used the term mystyles again. If you want to keep things simple, then just stick with using mystyles."
-
Understanding the concept of separated layout and content
SamC replied to Anke's topic in Getting Started
That's it. Personally, after using Drupal, then Wordpress, I find it very liberating not having to set up predefined 'regions' or any of that stuff. I create the fields, populate them, then they go where I want them to go by simply sticking them in a template, job done. Craft CMS is very similar to this approach but has a price tag with it per site that led me to PW. Glad I did though, try it out, you might like it. Absolutely -
It's not working again now for some reason. I tried something out, I deleted everything in: /wire/modules/Inputfield/InputfieldCKEditor/mystyles.js ...but left the file there. Now when I go to the body field, my styles dropdown is empty even though I have my custom styles in: /site/modules/InputfieldCKEditor/mystyles.js ...like so: // mystyles.js CKEDITOR.stylesSet.add( 'mystyles', [ { name: 'Generic List', element: 'ul', attributes: { 'class': 'generic-list'} }, { name: 'Inline Code', element: 'code' }, { name: 'Inline Quotation', element: 'q' }, { name: 'Left Aligned Photo', element: 'img', attributes: { 'class': 'align_left' } }, { name: 'Right Aligned Photo', element: 'img', attributes: { 'class': 'align_right' } }, { name: 'Centered Photo', element: 'img', attributes: { 'class': 'align_center' } }, { name: 'Small', element: 'small' }, { name: 'Deleted Text', element: 'del' }, { name: 'Cited Work', element: 'cite' } ] ); I thought maybe a typo but I can't see anything wrong with it. Something is not right here, my file is not being used. Viewing the source on the edit page shows me this: "InputfieldCKEditor_body": { "baseHref": "/", "contentsCss": "/wire/modules/Inputfield/InputfieldCKEditor/contents.css", "extraAllowedContent": "", "extraPlugins": "pwimage,pwlink,sourcedialog", "removePlugins": "image,magicline", "toolbar": [ [ "Format", "Styles", "-", "Bold", "Italic", "-", "RemoveFormat" ], [ "NumberedList", "BulletedList", "-", "Blockquote" ], [ "PWLink", "Unlink", "Anchor" ], [ "PWImage", "Table", "HorizontalRule", "SpecialChar" ], [ "PasteText", "PasteFromWord" ], [ "Scayt", "-", "Sourcedialog" ] ], "format_tags": "p;h1;h2;h3;h4;h5;h6;pre;address", "language": "en", "entities": false, "height": "20em", "stylesSet": "mystyles:/site/modules/InputfieldCKEditor/mystyles.js?nc=1495895634", // << yes, that's my file, so where are my styles? "customConfig": "/site/modules/InputfieldCKEditor/config-body.js?nc=1474392859" }, Anyone else having problems with this? Thanks for any advice. ==EDIT== After a fair bit of testing, changes in the styles dropdown only happen when I edit mystyles.js in the /wire/modules/Inputfield/InputfieldCKEditor/ folder. My custom styles are ignored by the system. Do I have the correct path in my body field? This is on a subdomain, dev.mysite.com, but the relative path should be the same.
-
Ok, got the class working now: { name: 'Generic List', element: 'ul', attributes: { 'class': 'generic_list'} } So I create a standard list with the bullet list button, select it, then choose my custom style... ...which outputs: Sweet! And then I saved the page, and the class stayed there in the source, no ACF removal. CKEditor always strips stuff like this out when I add via source, but I guess using this custom file is instructing CKEditor to leave it alone.