Jump to content

SamC

Members
  • Posts

    733
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by SamC

  1. Indeed it DOES work! Tried: **word auto linked** Set in autolink module (ID or PATH): 'auto linked=1' Outputs: <strong>word <a href="link_to_homepage">auto linked</a></strong> Will make more use of this module from now.
  2. Sorry, but I use a different approach to templating and I find the above pretty confusing. I think another member will have to chime in here because I don't really understand the delayed output approach. That said, links that display but don't click sounds like a typo in the html/css. Is a row (invisibly) covering the buttons or something? Maybe double check the actual html output in the developer tools.
  3. You need two fields. 1) Create a new field, call it ''altTitle' (but can be any name). NOTE: if you're copy/pasting then the name must be 'altTitle'. 2) On the field 'Input' tab. Set max length to 70 and add a 'character counter'. 3) Add this field to any templates that need an alternate title. So now, if you want just the 'title' field: <title><?php echo $page->title; ?></title> Or just the 'altTitle' field: <title><?php echo $page->altTitle; ?></title> The 'altTitle' field OR the 'title' (i.e. if the 'altTitle' is empty or not present on the template, then will just print value of 'title'): <title><?php echo $page->get("altTitle|title"); ?></title> The 'title' field with the 'altTitle' appended to it (if 'altTitle' exists on template): <title> <?php echo ($page->altTitle) ? $page->title . " - " . $page->altTitle : $page->title; ?> </title> Good luck
  4. @houseofdeadleg could you post the code you are using from the template? (your work is very impressive btw, I enjoyed looking through the illustrations)
  5. Wow, this looks awesome, I have been using ckeditor for fields that only need <p>, <h2>, <ul>, <li>. One question, I am using the autolinks (pro field) module in my tutorials to avoid a lot of manual linking. Can I use markdown and autolinks on the same field?
  6. Yeah, just change: <title><?php if($page->id > 1) { echo $page->title .' - '; } echo $home->title ?></title> to: <title><?php echo $page->title; ?></title> ...and from then on the title tag of each page will be exactly what you type in the 'Title' field with nothing more added to it.
  7. No don't do that. 'windowTitle' and 'headingSubtitle' are fields I created on MY own site. You more than likely don't have these fields. Whats happening is this (as per your example earlier): <title> <?php // any page OTHER THAN the home page if($page->id > 1) { // prints 'Employer branding - pracownik staje się klientem -' echo $page->title .' - '; } // prints 'Agencja PR Q&A Communications – Poznań, Gdańsk, Warszawa, Bristol' echo $home->title ?> </title> So that bit of code outputs: Employer branding - pracownik staje się klientem - Agencja PR Q&A Communications – Poznań, Gdańsk, Warszawa, Bristol ...which is what you are seeing and you referred to it as: If you just want the first bit, then you just need: <title><?php echo $page->title; ?></title> I'm not even sure if you can log into the admin on your site? If you can, you will see the 'Title' field on each page if you edit it. Browsing your site, look at the page titles and you'll see what's happening: http://www.qacommunications.com/ (Agencja PR Q&A Communications – Poznań, Gdańsk, Warszawa, Bristol) http://www.qacommunications.com/pl/kariera/ (Dołącz do nas! - Agencja PR Q&A Communications – Poznań, Gdańsk, Warszawa, Bristol) http://www.qacommunications.com/pl/zakres-dzialan/ (Zakres działań - Agencja PR Q&A Communications – Poznań, Gdańsk, Warszawa, Bristol) http://www.qacommunications.com/pl/biuro-prasowe/ (Klienci - Agencja PR Q&A Communications – Poznań, Gdańsk, Warszawa, Bristol) See what the code is doing now? 'Agencja PR Q&A Communications – Poznań, Gdańsk, Warszawa, Bristol' is the 'Title' field of your homepage. This is being appended to every other page title on every page other than the homepage.
  8. The code is in a template file. We can't tell you which one because you can set up processwire according to your own preferences. If it's a live site then the files will be on the server yes. Template files go in '/site/templates/' so you need to start by looking in that folder. You're only looking for the file that contains the code that ouputs the <head> section of your site, that's where the meta (and title) tags go. It might be '/site/templates/_main.php' or '/site/templates/header.php' or '/site/templates/includes/header.php/'. See the problem? We can't guess as there's not a 'correct' or single way to organize processwire. This is one reason why I use it over any other CMS I've tried. If you're willing to learn, then with your current skillset, I think you'd go further with processwire. However, of you mean 'nice websites' by copy/paste then wordpress would work better for you simply because there are 1000s of code examples.
  9. Yeah I thought of something like that, used to do it in Drupal 7. I think same level child pages would be easiest for me here.
  10. The blog-entry template has a repeater matrix field which is great for this. I can add body > image > body > code > image > body etc. I was looking at this: https://processwire.com/docs/tutorials/simple-website-tutorials And seems that what you described is going on there. I didn't pay close enough attention to see that there is a parent summary page. Think I'll just make another template 'complete-tutorials' and as you say, list the entries under that. I could use the parent page to show what's actually going to be created as a teaser. I'm not a fan of multi-page tutorials (i.e. nasty SEO let's make 10 pages out of one) at all. They're a pita. However, i think there is a case when it comes to complete 'start to finish' tutorials, it makes sense to split them up into sections.
  11. I've got the structure: Tutorials (blog-index template) Any child of that (blog-entry template) I know I could have 'Page 1 of tutorial' being some sort of list which shows an extract of the children but I didn't want that here. Page 1 should look the same as the children. I've modified the template to include a menu at the top when on a page which (a) has children or (b) the parent pages' template is 'blog-entry'. The important bits are here: // blog-entry <?php namespace ProcessWire; ?> <?php // parent of multi page tutorial if ($page->hasChildren()): $entries = $page->and($page->children); ?> <ul> <?php foreach($entries as $index => $entry): ?> <li>Page <?= $index + 1; ?> <a href="<?= $entry->url; ?>"><?= $entry->title; ?></a></li> <?php endforeach; ?> </ul> <?php elseif ($page->parent->template == "blog-entry"): // parent and children of multi page tutorial $entries = $page->parent->and($page->parent->children); ?> <ul> <?php foreach($entries as $index => $entry): ?> <li>Page <?= $index + 1; ?> <a href="<?= $entry->url; ?>"><?= $entry->title; ?></a></li> <?php endforeach; ?> </ul> <?php endif; ?> <div class="container py-5"> <div class="row justify-content-center"> <div class="col-lg-9"> <?php if($page->bodyRepeater): ?> <?= $page->render("bodyRepeater"); ?> <?php endif; ?> </div> </div> </div> ...which outputs: at: /processwire-tutorials/page-1-title/ /processwire-tutorials/page-1-title/page-2-title/ /processwire-tutorials/page-1-title/page-3-title/ So in essence, 'it works'. A user can navigate between the parent and the children and they look like a coherent section. However, two blocks in the code above are repeated and I was thinking is there a way to do this with the built in pagination or a way to condense the code? The main problem I'm having is that I want to include the parent which means there are three conditions when displaying the menu: 1) Is a blog-entry post and has blog-entry children - show menu 2) Is a blog-entry post and parent is blog-entry - show menu 3) Is a blog-entry post and has no children - hide menu Or should I just get on with life? Just after some feedback really on how other people would handle something like this. Thanks for any advice.
  12. You're a braver man than I. Good luck!
  13. As much as I love trying out new CSS, I only ever use safe (ish) techniques so grid will have to wait for me. Probably at least another year as I've only just ditched floats for flexbox.
  14. Just to clarify, what I said was not intended as an insult, far from it. I meant with some more learning, you'll be able to do this stuff no problems. I come from the othet direction in that wordpress makes no sense to me but a 'proper' CMS does. I mean proper by one with custom fields, templates etc... out the box. Like I said, posting the code you have that renders your head section (or the entire template) would be extremely useful here.
  15. Processwire doesn't automatically add anything, It's up to the designer/developer what text is output. That said: I've already described how to do this earlier. I think you're possibly not fully understanding how the templates/fields work together yet because what you're trying to do is pretty simple once you get the hang of these concepts, you certainly don't need a module here. Could you post the code from your template that outputs the <HEAD> section of that page and we can sort something out
  16. I'm not sure we're on the same wavelength here. What do you need the module for? Every page has a title field, it's mandatory. You name the page anything you want when you you create it (you can edit it anytime too) and will be unique for each new page you create (because it wont allow duplicates). For example, I could create a template called 'about'. Then create a page called 'About me' using the 'about' template. That page has a title field which I could fill in with 'This page is about me'. Publish it and then you can output the field like so in a file '/site/templates/about.php': <html> <head> <title><?= $page->title; ?></title> </head> <body> STUFF </body> </html> So at 'yoursite.com/about-me/' you would get: <html> <head> <title>This page is about me</title> </head> <body> STUFF </body> </html> Are we even talking about the same thing?
  17. You need to add the field to the template which was used to create the case study page. On the page edit, can see settings tab. That will show you which template is being used. Details/input/actions are for specific settings on a field. The code will go in the template file i.e. /site/templates/basic-page.php or wherever your head section is rendered from. Maybe '_main.php'? It depends on your approach to organzing your templates.
  18. All done in admin area. In my example, the fields are: metaDescription (text area) windowTitle (text field) headingSubtitle (text area) Create them at admin > setup > fields. Add to template at admin > setup > templates (for example, edit 'basic-page' template and add fields). Edit/create page with 'basic-page' template. Fields will be there now. Output on webpage via template file located at '/site/templates/basic-page.php'. Of course this applies to any templates you like and can structure them as you wish. I prefer to use something like the second code block in this example but there are other approaches, experiment a bit: Hope this helps
  19. You can use the pipe character too. I use this: <meta name="description" content="<?php if ($page->metaDescription) {echo $page->metaDescription;} ?>"> <title><?= $page->get("windowTitle|headingSubtitle"); ?></title> I use field 'windowTitle' to specifically change the main title for each page individually for SEO purposes. If not present or present but blank, use 'headingSubtitle' field.
  20. @heldercervantes that site is INSANE! Not my style at all, but just, wow! Well done. WebGL totally crapped the bed though on the contact page, page flashed a few times, flickered, got a chrome error bar at the top, webgl has crashed. Worked after a refresh though and I had a good look around. Very impressive. My PC is a few years old, i5-4670k with an nvidia GTX750. My internet is pretty quick (has to be with the stepsons online gaming/chatting/video watching when I'm trying to make websites!).
  21. I'm working on something like this. Here's how I did it so far. Templates x 4: /tutorials/ (blog-index) /tutorials/tutorial-title/ (blog-entry) /tags/ (tag-index) /tags/tag-name/ (tag-entry) Tree structure: blog-entry has a multiple page ref field called 'tags'... ...like so: tag-entry has a multiple page ref field called 'blogPosts'... ...like so: Using: https://modules.processwire.com/modules/connect-page-fields/ (this module has been very very useful so far, written by @Robin S and recommended to me by @abdus) The fields are connected thus: So when I create a tutorial (blog-entry template), I can select a bunch of tags (or create new ones): ...the page created with 'blog-entry' is automatically added to the associated tags in the 'blogPosts' page ref field: So now you have the posts listed under the actual tag, it's as simple as just iterating over the 'blogPosts' page ref field: <?php namespace ProcessWire; ?> <div class="container py-5"> <div class="row"> <?php $tags = $pages->get("/tags/")->children; foreach ($tags as $tag): if (count($tag->blogPosts)): ?> <div class="col-md-4 mb-5 px-md-5"> <h2 class="display-4"><a href="<?= $tag->url; ?>"><?= $tag->title; ?></a></h2> <?php // return PageArray of all items in blogPosts ref field $posts = $tag->blogPosts; // sort the PageArray $posts->sort("-postDate"); // only want first 3 items $posts = $posts->slice(0, 3); // loop through the 3 items foreach ($posts as $entry): ?> <p><a href="<?= $entry->url; ?>"><?= $entry->title; ?></a></p> <?php endforeach; ?> </div> <?php endif; endforeach; ?> </div> </div> Still not decided how to list them when there are multiple tags, but hope this gives you some ideas.
  22. They look interesting, thanks. I did something along these lines previously: <?php $options = array('quality' => 80, 'cropping' => 'center'); $small = $image->size(500, 325, $options); $medium = $image->size(1000, 650, $options); echo "<img sizes='100vw' srcset='{$small->url} 500w, {$medium->url} 1000w' src='$medium->url'>"; ?> After reading a bunch of tutorials, still not sure whether you set the src="" to the smallest available image or the largest one (in case of fallback needed).
  23. Thanks for the replies. I had run into some memory issues before I started setting a max-width. It's for the tutorials site I'm working on which are manual screenshots from a 2013 macbook pro at 2750px (ish). I settled now on: Max upload size: 3000 (unlikely to ever exceed this anyway). Image displayed on page: 1200px Modal: 1800px (on desktop) Covers a bunch screen sizes (looks great on 2560x1440) and gives some size increase headroom. 4k or 5k I can't test on sadly. Prob need to use srcset to accomodate mobile users but tbh, this site would suck on a mobile. Anyway, rambling on.
×
×
  • Create New...