Jump to content

mel47

Members
  • Posts

    370
  • Joined

  • Last visited

Posts posted by mel47

  1. Thanks for answers. So I understand, from both of you, I should have a specific template and not an universal basic-page one. It's fine.

    However I'm still unable to display all categories and all links on the page.

    $links = $pages->find("template=links");
    foreach($links as $l) {
        $content .=  "<li><a href='{$l->url}'>{$l->title}</a></li>"; //fine for displaying categories but missing the repeater.
       // echo $l->render();  doesn't work, copy all the page (including header, etc..)
    }

    So how I get all children but also their own children ? How I could refer to the repeater (which have already his template) ? It's probably something about the each() @blynx mentions. However I have no idea what to do with it and couldn't find any examples in the forum.
    Sorry for my ignorance.

    Mel

     

  2. Hi

    I read tons of posts/tutorials about categories and variations on the same subject. However, I think there is something I don't understand or just use a wrong design. Does someone could kindly explain where is my problem?

    Directory (basic-page template)

     --  Category (links template)

       ---  Link 1 (repeater)

     

    I have no problem to output the content of the repeater on his own page of category. However, my problem is to list everything on the directory page. I suppose I can do a $page->find("template=links") but it make no sense to add that on a general basic-page template. Or do I should have a specific template for the parent page? Or some kind of function I can reuse? (I have the exact same problem for my gallery page with a category and their children)

    Thanks.

    Mel

     

    Links template
    $content .= $page->render('links'); 
    
    /Fields/links
    function renderLinks($page) {
    foreach($page->links as $link) {
    			echo "<h2><a href='{$link->http_link}'>{$link->title}</a></h2>";
    			echo "<p>{$link->summary}</p>";
    			echo "<p><a href='{$link->one_image->url}'><img src='{$link->one_image->url}' alt='{$link->one_image->description}' ></a></p>";
    		}
    	}
    $content = renderLinks($page); 

     

     

  3. Hi
    Still on my quest to build my website. Since now I know how to basically display fields, I'm now at a design' step. I know I can do, what, and how, I want using PW, but there is so many possibilities! Could you help to choose the more efficient technique and/or point me pro and cons of each of them?
    My page is a classic team page
    Team
       Some text
       Director 1 (photo+text)
       Director 2 (photo+text)
       Other members
         ~35 photos separated in differents categories (photo, name and position title)
       Some text
       
    Method 1 : a page for each section. Pictures uploaded in one field, as described here. Using photo tags to create the different sections and description for name and position.

    Method 2: each person is a page. A field "category" will be added to displayed them correctly.

    Method 3 : repeater but I'm not sure yet how it works and his advantage or inconvenient.


    I have 35 photos to upload for now (one time upload, after I will add/modify only 2-3 by year). I was thinking using a module to batch Import via CSV to create pages (which seems to speed up with method 2) (However, I don't know if it's working for images). On the other hand, method 1 is also easy for uploading pictures in 1 click. However, adding description in batch seems more complicated and less easy to maintain (more clicks to see them).

    Also, subsidary question. If I want to re-use some pictures in an other webpage, is it easier to reuse from this page or just reupload and recreate a child page in an other page?

    Do I miss something?
    Thanks
    Melanie

     

  4. Hi,

    So, first question...

    To learn how to use PW, I tried to build a really basic news system. So I created a news template with 4 fields - title, date, summary, image. Done.

    After, as I was not sure I started from basic-page.php and tried to modify by using HTML from my old website. After many trials and errors, I succeed to display something.

    <?php namespace ProcessWire; 
    
    $content = "<article><h2>" . $page->body  . "</h2>
    <header class='news-meta'>
    <strong>Date : </strong> " . $page->get("publish_date") . "
    </header>
    <div class='news-content-text'>
    <p>". $page->get("summary") . "</p>
    </div>
    <div class='article'> text </div>
    " . "<p><img src='" . $image->url."' alt='". $image->description . "' ></p> </article>"; //image doesn't work!!
    
    // If the page has children, then render navigation to them under the body.
    // See the _func.php for the renderNav example function.
    if($page->hasChildren) {
    	$content .= renderNav($page->children);
    }
    
    // if the rootParent (section) page has more than 1 child, then render 
    // section navigation in the sidebar (see _func.php for renderNavTree).
    if($page->rootParent->hasChildren > 1) {
    	$sidebar = renderNavTree($page->rootParent, 3); 
    	// make any sidebar text appear after navigation
    	$sidebar .= $page->sidebar; 
    }

     

    So my questions :

    1. I don't like it, way too much concatenation and I'm lost between " and '. How I should do that?
    2. Why this template is not similar to main.php with a part in php and one in html? In fact, my problem is that I'm not sure how to mix them
    3. Why page->body doesn't throw all fields of the template? More specifically, what is it? I can't find it in the cheatsheet...
    4. Why basic-template.php have an open <? php but any closing bracket?

    Thanks!!

    Mélanie

  5. Thanks for your answers. I decided to give a shot and try version 3. To be honest, I don't really know what is namespace and what to do with it but since I start from scratch, it may be better to go with the future stable version.  I don't think I will really need modules other than the core so it shouldn’t be a problem.

    Next step is now finding my design...

    • Like 1
  6. Hi,

    I'm in process to convert my existing website to another CMS. After extensive searches and trying tons of demo, I found this one. I played the demo and also create a local install. It seems great, and will probably fit my needs, mostly because of the built-in multilingual support.

    I currently tried the 2.7.2 version but I was wondering if I should start developing on the beta version? Is it to a level enough stable or I should go with something more stable but without the new functionnalities? I expect to work for the next weeks (maybe all the summer) on my website, since I have to learn, build the skeleton and I have a lot of content to transfer. 

    Thanks

    Mélanie

×
×
  • Create New...