Jump to content
pycode

Learning platform built on ProcessWire

Recommended Posts

Hello PW, 

discovered few days ago this awesome cms and now want to start a project on it, but need some help. I'm coming from the drupal side, which I kinda like, but it is not usable for smaller projects like I need now. I like it's way to build to content from the ground up, but it feels heavy, don't know why. PW feels really light and want to give it a try.

Long story short, development it is a hobby for me, so everything I do is self-learned throw try & error, no programming skills yet. I want to learn JS now, and for that, want to translate a website to my native Romanian language so I can learn myself and others in the future. The site I'm talking about is www.learn.javascript.ru

I want to build a similar structured site (please see the attached image):

pw.png.e4fe2018f6b40722b3a745438ce8fb24.png

Home / Projects / About will be basic page template based, no problem with them.

mysite.com/javascript/

Starting Learn JavaScript will be a basic page template as well, I can make it statit, as it will contain some info and links to the Sections of the JS theory pages.

mysite.com/javascript/section-name/

By accessing a section page, I want to see again some description text and links of the attached unit pages to this section, so when I open any section it shows me all the attached unit pages to it. On the sidebar, I need to render links to all the sections, just that.

Next is unit pages like mysite.com/javascript/section-name/unit-name/

Here goes the units text, main content in other words, like a blog post. The key point is to have a dropdown and select the section page for it. For sidebar, I want to render the list with links for every headline from the unit page. Will do it by using Jumplinks Hanna Code, I believe it will do the job perfectly.

Who can give me a hand with the templates?

first /javascript/ page I can do as a basic page.

next /javascript/section-name/ don't know. what fields should it contain for linking units?

and last /javascript/section-name/unit-name/ again, what field needs to be used for linking? Page refference I believe?

How I write it to templates?

Would be gratefull for your help guys,

Thank you

 

Share this post


Link to post
Share on other sites

UPDATE #1

Trying to do it based on Blog Profile. Also modified the structure, so it goes LEARN JAVASCRIPT -> SECTION -> MODULE -> POST

Linked posts to modules and modules to sections with Page Refference, works well.

For first page (learn js) used this template:

<pre>

<?php namespace ProcessWire; ?>

<nav pw-append='content-body'>
    <?=ukDescriptionListPages(page()->children)?> 
</nav>

<aside id='sidebar'>
    <?php 
    $sections = pages()->get('/javascript/'); 
    echo ukNav($sections->children, [ 'header' => $sections->title ]); 
    ?>        
</aside>

</pre>

Works so far so good.

for Section pages used this template:

<pre>

<?php namespace ProcessWire; ?>

<div id='content'>
    <?php
    echo ukHeading1(page()->title, 'divider'); 
    $posts = page()->children('limit=10');
    echo ukPlatformPosts($posts); 
    ?>
</div>

<aside id='sidebar'>
    <?php 
    $sections = pages()->get('/javascript/'); 
    echo ukNav($sections->children, [ 'header' => $sections->title ]); 
    ?>        
</aside>

</pre>

DOES NOT WORK as it gives me an error. <pre>Error: Uncaught Error: Call to a member function count() on null in /Applications/MAMP/htdocs/processwire/site/templates/_uikit.php:777
Stack trace:
#0 /Applications/MAMP/htdocs/processwire/site/templates/_uikit.php(842): ProcessWire\ukPlatformPost(Object(ProcessWire\Page), Array)
#1 /Applications/MAMP/htdocs/processwire/site/templates/section.php(7): ProcessWire\ukPlatformPosts(Object(ProcessWire\PageArray))
#2 /Applications/MAMP/htdocs/processwire/wire/core/TemplateFile.php(287): require('/Applications/M...')
#3 /Applications/MAMP/htdocs/processwire/wire/core/Wire.php(380): ProcessWire\TemplateFile->___render()
#4 /Applications/MAMP/htdocs/processwire/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___render', Array)
#5 /Applications/MAMP/htdocs/processwire/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array)
#6 /Applications/MAMP/htdocs/processwire/wire/modules/PageRender.module(514): ProcessWire\Wire->__call('render', Array)
#7 /Applications/MAM (line 777 of /Applications/MAMP/htdocs/processwire/site/templates/_uikit.php) 

This error message was shown because: you are logged in as a Superuser. Error has been logged.</pre>

For Modules used this template, works as intended. Also need to add in the sidebar the list with all the modules of the current section. <pre>

<?php namespace ProcessWire; ?>

<div id='content'>
    <?php
    echo ukHeading1(page()->title, 'divider'); 
    $posts = page()->children('limit=10');
    echo ukPlatformPosts($posts); 
    ?>
</div>
</pre>

And for post used this template. <pre>

<?php namespace ProcessWire; ?>

<div id='content'>
    <?php 
    
    // blog post content
    echo ukPlatformPost(page());
    
    // comments
    $comments = page()->comments;

    // comment list 
    if(count($comments)) {
        echo ukHeading3("Comments", "icon=comments");
        echo ukComments($comments);
    }

    // comment form
    echo ukHeading3("Post a comment", "icon=comment"); 
    echo ukCommentForm($comments);
    
    // link to the next blog post, if there is one
    $nextPost = page()->next();
    if($nextPost->id): ?>    
        <p class='next-blog-post'>
            Next <?=ukIcon('chevron-right')?>
            <a href='<?=$nextPost->url?>'><?=$nextPost->title?></a>
        </p>
    <?php endif; ?> 
</div></pre>

Works as intended, except the linking for next article. I would like to add previous and next links for articles within the module.

Attaching uikit.php, as I believe the problem with that error goes from there.

My php skills are pretty weak, please help to get some light on this project.

Thank you

 

_uikit.php

Share this post


Link to post
Share on other sites

Hi @pycode, welcome to the forum.

First advice, if you need more answers, try to format your post with the forum tools so it will be more readable by us !

Wrap your code into the code tag, use quote for errors, etc. :)

 

About the error you are encountering, looking at the line 777 of the _uikit.php

$n = $page->comments->count();

It seem that the function want a Page with a comments field registered on the template.

To fix it, just add the comments field to the according template and everything should work.

 

I also suggest you to read this thread :

 

  • Like 2

Share this post


Link to post
Share on other sites

Thank you @flydev for your answer, by try and error came to the solution you posted :) Sorry about that long and unformatted post, seems like I can't edit my posts after few minutes posted, so can't do anything about it already :(

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By abdulqayyum
      Hy everyone,
      i am using loginRegister module for front-end user login.
      In this module user can login with Email/username, i am showing with Email. done
      but not showing Email in Forgotton Password section. there still showing with username.

      i want to show Forgotton Password with Email instead username. and should reset with email.

      please help me in this section, how i can set it with Email.

      Thanks AbdulQayyum.
    • By abdulqayyum
      Markup-Google-Recaptcha is not working with LoginRegister module in Forgotton Password Form.
      Here is my code
      wire-> modules -> process -> ProcessForgotPassword.php
      protected function step1_renderForm() {
              $form = $this->modules->get("InputfieldForm");
              $form->attr('action', './?forgot=1');
              $form->attr('method', 'post');
          
              $field = $this->modules->get("InputfieldText");     
              $field->attr('id+name', 'username');
              $field->attr('class', 'redesign-field forgotPassFeild');
              $field->setAttribute('placeholder', 'Username');
              $field->required = true;
              $field->label = $this->_("Forgotton Password");
              $field->description = $this->_("If you cannot remember your password to access the affiliates portal. simply provide your username in the box below and we'll send you a reset link via email.");
              $form->add($field);
               
             // Calling MarkupGoogleRecaptcha Module.
              $captcha = $modules->get("MarkupGoogleRecaptcha");
             //  rendering form with recaptcha
              $captcha->render($form);
         
              $submit = $this->modules->get("InputfieldSubmit");
              $submit->attr('id+name', 'submit_forgot');
              $form->add($submit);
              $this->session->userResetStep = 1;
               
              // rendering form
               $out .= $form->render();
          
              // getting captcha script
              $out .= $captcha->getScript();
              return $out;
          }

      I am following this one example.

      please suggest me how i can show MarkupGoogleRecaptcha in forgotton password.
      Getting log error


      Thanks,
      Abdul Qayyum
    • By Mithlesh
      Hi there,
      My form is not getting submitted, it is showing:
      Unable to verify successful email delivery of this form submission.
      Attaching for your reference as well: 

      In the Backend, it is showing Connection timed out with smtp.gmail.com
      Pl guide me how to resolve that
    • By Sephiroth
      Hi guys, so since I moved to Processwire, it has been my default go-to CMF/CMS for my website and client applications, apparently my previous job took a toll on me, and made me have less time, but now finally had the chance to change my website to something I always had in mind.
      I decided to go with something minimal, as I tend to enjoy writing, so wanted a website to have more text than graphics and I think I whipped up something clean. Currently I still have more to do, but this is my current website, the main purpose to have a content driven website where I will be writing tutorials , articles more and hopefully  technical  notes.
      Please let me know your honest opinion.
      PS: I am more of a coder than a designer but i think this old dog still pulled it off
       
      https://okeowoaderemi.com/
       
       




    • By abdulqayyum
      hello processwire community,
      i am using LoginRegister module for front-end user registration. i am facing an issue verification email not receiving while WireMailSmtp is working perfectly and user receives message
      "Thank you, a confirmation code has been emailed to you. When you receive the email, click the link it contains, or paste the confirmation code below."
      received this message in front-end but does not receive any email relevant it.
      please help me in this case how i can solve it.
      Please check screen shots for SMTP test and message which receives user.
      Thanks AbdulQayyum,

      First screenshot SMTP test message, second when user receives message after clicking register button.
×
×
  • Create New...