Jump to content

pwired

Members
  • Posts

    2,291
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by pwired

  1. You can use the template name (both external and internal template) to choose any layout for any webpage or any part of the website

    I have the layouts stored in a view and an include folder and select them with php logic either on the template file or the view file

    This layout strategy is already in the forum posts for many years

    Here is an example:

    <?php namespace ProcessWire;
    // you can add here any business logic if needed to override default settings, values and $variables
    
    // default <head>
    include ($includes_path . "head.php");  // <head> is not a view such as the <header> <main> or <footer> - it is the <head> section of a website
    
    // default view <header>
    include ($views_path . "header.php");   // the <body> tag and the first <header> tag after the <body> tag
    
    // selected view <main>
    include ($views_path . "{$page->template->name}" . ".php");   // the main content view selected with the page template name (internal or external template file name)
    
    // default view <footer>
    include ($views_path . "footer.php");

     

  2. Quote

    Otherwise find() will give you a PageImages object that potentially holds multiple images, so calling url() on it won’t work.

    Thanks @Jan Romero for showing the correct way in this case:

    $p->images->get("videocounter=270")->url;


    I am aware now that I have to dive deeper into the processwire api with the use of arrays, Pageobjects and selectors ...

  3. Hi,

    In a page I want to find an image that has a specific field with a specific value

    In this case the Page = $p and the image that I am looking for has a field = videocounter and the value of this field = 270

    I can find the image like this: $image = $p->images->find("videocounter=270");

    so far so good

    But when I want to show the picture on the front: <img src="<?php echo $image->url ; ?>" />

    It doesn't work, the image does not show

    With a few simple echos of $image;  and  $image->url; I found a work around that makes the image show up:

    <img src="<?php echo $image->url . $image; ?>" />

    But I find this an ugly work around

    What would be the correct way to make the image show up ?

     

  4. Processwire is a headless cms/cmf and as such it only delivers your backend to the frontend
    in anyway you want with 0 limitations. That is what makes Processwire so great.

    Choose any cms framework you want but I really recommend not to start with big ones
    like bootstrap - uikit - etc.

    I recommend to start with pocketgrid css because it is perfect to first get familiar
    with using the processwire api outputting backend data on the front.

    https://arnaudleray.github.io/pocketgrid/
    https://arnaudleray.github.io/pocketgrid/docs/

    Once familiar with the Processwire api you can choose any cms framework you like.
    Bulma css is a great choice also ... flex based and all css ... no preinstalled JS, modular components (only use what you need)

    https://bulma.io/documentation/overview/start/

     

  5. Quote

    // config.php (or init.php) $config->paths->set('home_sidebar_timeline', $includes_path . 'home_sidebar_timeline.php');

    Ah yes I forgot about make use of the config.php (or init.php) ..... thanks for pointing me there, will try that too.

    The paths that I declared in the _init.php ..... I simply declared them again on top of my hanna php code and now my hanna code is working in my ckeditor field

    So either way what will work I mark the question as solved.

    Note - did you guys know you can render a hanna code directly in a template like this:

    $hanna = $modules->get('TextformatterHannaCode');
       echo $hanna->render("[[my_hanna_snippet]]");

    https://processwire.com/talk/topic/14141-outputting-a-hanna-code-via-the-api-in-a-template/

    Hanna Code is actually a powerful option.

     

    • Like 1
  6. Hi,

    I am using a hanna code in a ckeditor field  [[timeline]]

    In the _init.php I have declared
    $home_sidebar_timeline = $includes_path . "home_sidebar_timeline.php";

    Can I use variables declared in the _init.php in a hanna code ?

    I have this php code in my hanna code:

    <?php include $home_sidebar_timeline; ?>

    When I put the hanna code [[timeline]] in a ckeditor field it doesn't work.

    How can I use a variable declared in the _init.php in a hanna code
    Do I need to use global variables ?

     

  7. Quote

    Must be a mistake in the blog post, I’m pretty sure Ryan meant the “Details” tab

    Hi@Jan Romero,

    Thanks for pointing me back to the Details tab.

    Yes, now I have Ryan's suggestion working: you might want to disable the description and/or tags fields for the image,
    just for a more consistent appearance of inputs (though it's not required).

    The consistent appearance shows up and I simply use the Title instead of Description.

    How I ended up with this matter ?

    I was trying to add links to my images with <a> .... </a> and going through the forum posts
    first the module ImageExtra came up. Then I was reading a post of Jonathan Lahijani about
    the ability to have custom fields for images.
    All good now.

     

     

  8. Hi,
    I am setting up custom fields support for file and image fields as described here:
    https://processwire.com/blog/posts/pw-3.0.142/

    I am using a Field with name: images and type: images

    All works well except for one thing.
    In the blog post it says: on the Input tab, set the Number of rows for description field to 0 (zero).

    When I go to my images field ... Setup > Fields > images and then go to the Input tab, there are a lot of settings there
    but I cannot find anything that says Number of rows for description field as mentioned in the blog post

    Anyone has an idea why that might be ?

     

  9. Quote

    Since I'd like to avoid using composer I downloaded the library from php-download.com which make it possible just to include the autoloader.php file and using the library directly. So I got it ... just removing "namespace Processwire" on top of the module ...

    Thought that I was the only one trying to avoid composer. Thanks for posting this working solution
    (added to my snippets)

    • Like 2
  10. Quote

    I always hard-code things that usually never change during the lifespan of a website. For example footer address information, logos, social media icons, etc.

    Yes that makes sense. But in case of a multi language website how would you manage the text in the footer and the text on banners and banner slides, etc. ?

  11. Who is still hard coding graphics like a logo, banner, etc in sub folders like logo or banner in the styles folder ?

     

    hardcoded.jpg.40980025159aba5433d026779ae4a0cf.jpg

     

    I stopped working that way and create "Pages" in the back end such as a logo "Page" and a banner "Page"

    That way a logo and a banner etc. can be managed directly through the back end and no longer need a third party FTP tool.
    Makes it also more easy for the website user/client.

     

     

  12. To make all the html layout better readable will make the workflow more productive
    I assume latte will allow me to rewrite php includes like this:

    <div class="header_navigation block">
        <div class="header_language block">{language}</div>
        <div class="header_navbuttons block">{navbuttons}</div>
    </div>

     

     

     

     

  13. Quote

    I don't know when I last found a tool for my daily work that had such a huge impact as Latte ...

    On the latte website I am reading some interesting things:

    - You don't have to look in the documentation. You don't have to learn another language. You just write like in PHP.
    - Latte is a next generation templating system – it understands HTML. Where other systems see only a bunch of characters, Latte sees HTML elements.
    - Latte is based on PHP, whereas Twig is based on Python. A designer in Latte doesn't have to constantly switch between two different conventions.

    I am using placeholders in my html using php and I must say it works really good and fast
    like this:

    <div class="header_navigation block">
        <div class="header_language block"><?php include $header_language; ?></div>
        <div class="header_navbuttons block"><?php include $header_navbuttons; ?></div>
    </div>

    Here is my question:

    Could you say from your own experience if using latte shortcodes make more productive and is the overhead worth it ?

     

  14. Quote

    Since CKEditor 4 will reach EOL in 2023 it's a good time to start planning for CKEditor 5 and I'm excited to work with it. 

    Is it really necessary to have CKEditor 5 in Processwire ? Is CKEditor 4.x not more than safe and powerful enough already ?
    CKEditor 5 will not make more productive neither make a website client more happy. It will only make things more bloated.
    At least leave the option with the user and client to choose CKEditor 4.x or another simple Editor for the client.

    Most clients are non-tech people occupied with business for whom something like CKEditor 4.x is already complicated.
     They will never use all its options anyway. All they need is to change some prices, text and pictures.
     So please leave the option for the client to choose a simple Editor.

    Quote

    the core of CKEditor 5 has changed and implementing it in PW will require significant changes,

    What made Processwire stand out from the crowd was its focus on a versatile and powerful api with a core free from bloat.
    How much of that is still true ?

    • Like 3
×
×
  • Create New...