Jump to content

Gideon So

Members
  • Posts

    353
  • Joined

  • Last visited

Posts posted by Gideon So

  1. 7 hours ago, howsoonisnow90 said:

    it doesn't work, it gives me these errors: 

    Notice:  Undefined variable: root in /Applications/MAMP/htdocs/realwanderlust/site/assets/cache/FileCompiler/site/templates/viaggi.php on line 89

    Notice:  Trying to get property 'children' of non-object in /Applications/MAMP/htdocs/realwanderlust/site/assets/cache/FileCompiler/site/templates/viaggi.php on line 89

    Warning:  Invalid argument supplied for foreach() in /Applications/MAMP/htdocs/realwanderlust/site/assets/cache/FileCompiler/site/templates/viaggi.php on line 91

    Hi @howsoonisnow90,

    I have updated the code. Please try the updated one.

    Gideon

  2. 16 hours ago, kongondo said:

    @Gideon So,

    Please correct your code. It is broken in several places (missing braces, etc.). For instance:

    Here you close </li> early, before its children (nested ul). 

    I think you meant $pages->get(1) 🙂.

    Hi @kongondo,

    Thanks for checking my code. Have just updated it.

    Gideon

  3. Hi @howsoonisnow90

    <?php
    
    $root = $pages->get(1);
    
    $children = $root->children;
    
    echo "<ul>";
    
    foreach($children as $child) {
    
      if($child->id == 0108) {
    
          echo "<li>$child->title";
    
         echo "<ul>";
    
       foreach($child->children as $grandchild) {
    
        echo "<li>$grandchild->title</li>";
    
      echo "</ul>";
         
      echo "</li>";
    
       } else {
    
       echo "<li>$child->title</li>";
    
      }
    
      }
    
    }
    
    echo "</ul>";

    Hope this helps.

    Gideon

  4. Hi,

    The module works well so far but I have just found that it is not working when it is place in the home template. I get the following error message in the browser console.

    Uncaught TypeError: ProcessWire.config.InputfieldCKEditor is undefined

    I tried to place the field to other template and it works normally.

    Any hints??

    Gideon

  5. I migrated a site to a hosting company which provides cPanel to manage the domain. I have some errors like the following:

    2021-07-09 05:09:32.453548 [ERROR] [5674] [HTAccess] Failed to open [/home/misfmorg/public_html/site/.htaccess]: Permission denied
    2021-07-09 05:09:28.141643 [ERROR] [5674] [HTAccess] Failed to open [/home/misfmorg/public_html/site/assets/files/1058/.htaccess]: Permission denied
    2021-07-09 05:09:27.067796 [ERROR] [5674] [HTAccess] Failed to open [/home/misfmorg/public_html/site/assets/files/1093/.htaccess]: Permission denied
    2021-07-09 05:09:26.775691 [ERROR] [5674] [HTAccess] Failed to open [/home/misfmorg/public_html/site/assets/files/1091/.htaccess]: Permission denied
    2021-07-09 05:09:26.672877 [ERROR] [5674] [HTAccess] Failed to open [/home/misfmorg/public_html/site/assets/files/1099/.htaccess]: Permission denied
    2021-07-09 05:09:26.471388 [ERROR] [5674] [HTAccess] Failed to open [/home/misfmorg/public_html/site/assets/files/1092/.htaccess]: Permission denied
    2021-07-09 05:09:26.086949 [ERROR] [5674] [HTAccess] Failed to open [/home/misfmorg/public_html/site/assets/files/1053/.htaccess]: Permission denied

    I checked the permission if the .htaccess file is correct and I wonder why the web server keep searching .htaccess file in every folder in the site assets folder.

    Any hint is welcome.

    Gideon

     

  6. Hi @milo695,

    <?php foreach ($homepage->children as $item): ?>
                    <li class="nav-item">
                        <a class="nav-link" href="<?php echo $item->url; ?>"<?php if ($item->id == $page->rootParent->id): ?> class="active"<?php endif; ?> title="<?php echo $item->title; ?>">
                            <?php echo $item->title; ?>
                        </a>
                    </li>
                <?php endforeach; ?>
                

    This piece of code only loop through the children page of the home page. Therefore only first level menu items are shown.

    You need to loop through the sub page of each $item to show all the subitems.

    <?php foreach ($homepage->children as $item): ?>
                    <li class="nav-item">
                        <a class="nav-link" href="<?php echo $item->url; ?>"<?php if ($item->id == $page->rootParent->id): ?> class="active"<?php endif; ?> title="<?php echo $item->title; ?>">
                            <?php echo $item->title; ?>
                        </a>
    					<?php if($item->children->count()): // if there is a child page, loop through all the child page ?>
    						<ul>
    							<?php foreach($item->children as $subitem): //loop through all the sub-page of the current $item ?>
                              	<li class="nav-item">
                        			<a class="nav-link" href="<?php echo $subitem->url; ?>"<?php if ($subitem->id == $page->rootParent->id): ?> class="active"<?php endif; ?> title="<?php echo $subitem->title; ?>">
                            		<?php echo $subitem->title; ?>
                        			</a>
    							</li>
    							<?php endforeach; ?>
    						</ul>
    					<?php endif; ?>
                    </li>
                <?php endforeach; ?>
                

    You can modify  it to suit your theme to make the dropdown work,

     

    Gideon

  7. For now, if a site needs non ascii page name, there are two setting needed to be set:

    1. $config->pageNameCharset = "UTF8"

    This is OK.

    1. $config->pageNameWhitelist = "A very long Chinese Character List"

    It is very hard to put all the Chinese character there. I always get complaint from my client that they find missing character in the url.

    Then I have to add that character manual. This is very painful and troublesome.

    If there is another way to whitelist all the non-ascii character would be a big plus to ProcessWire multi-language support.

    Forum thread: https://processwire.com/talk/topic/12776-pw-3012-support-for-extended-utf8-page-namesurls/?page=2&tab=comments#comment-146652
     

    Feature request: https://github.com/processwire/processwire-requests/issues/393

    If you think this feature is essential to you, please consider to up-vote the request to draw attention to Ryan.

    Thanks.

    Gideon

×
×
  • Create New...