clsource

Processwire Ghost Blog Clone

Recommended Posts

Thanks a lot for sharing! I will definitely take a closer look at it as soon as I have the time.

  • Like 1

Share this post


Link to post
Share on other sites

@clsource I have installed the profile, however, I ran into two issues:

Quote

Notice: Undefined variable: canonical in /Users/guru/Documents/MAMP/playground/pwclone_loc/site/templates/views/default_view.php on line 4
MENU

And most importantly: the home page is the only one that works, otherwise I get "Not Found The requested URL /[ANY-PAGE-REQUESTED]/ was not found on this server." errors.

Why? Thanks in advance!

Share this post


Link to post
Share on other sites

See if the htaccess is active.

normally Processwire installer transforms htaccess.txt to .htaccess

About that line 

if (!$canonical) {
    $canonical = wire('page')->httpUrl;
}

maybe I should change to isset or not null?

  • Like 1

Share this post


Link to post
Share on other sites

Morning,

I shouldn't have installed anything right before going to bed :) – Of course, it was the missing .htaccess file which I renamed to .htaccess.txt, so I managed to only prefix it with the dot... no comment :P

About the !$canonical issue, I changed it to isset just to make sure I do not get any php error reporting, but to tell the truth I have not yet taken a look at the code at al. I will do so in the following days, because I'm interested in your Wire Render Pattern.

BTW, one more issue to solve: are you sure that ghost/ghost.writer123 should let me in? It does not work, login fails.

Share this post


Link to post
Share on other sites

Odd.

Well you can always change the admin password

$u = $users->get('ghost');
$u->of(false); 
$u->pass = 'your-new-password';
$u->save();

put that in the _init.php or another place. (later remove it when its done :) )

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for your help! It was another error I made. It was the value of $config->userAuthSalt that I did not copy over from your config.php.

  • Thanks 1

Share this post


Link to post
Share on other sites

@clsource It's me again :) You might want to add a "Cover image" to the About page too, otherwise we get "...Trying to get property of non-object in..." notices. It might even be good thing to first test if an image is uploaded or not, but this might be overkill since – in the case of a real site –, no one should forget to upload an image which is an integral part of the overall design.

Share this post


Link to post
Share on other sites
4 hours ago, clsource said:

if (!$canonical) {
    $canonical = wire('page')->httpUrl;
}

maybe I should change to isset or not null?

I think it should be :

if (!isset($canonical)) {
    $canonical = wire('page')->httpUrl;
}

You intention was to use wire('page')->httpUrl when canonical is not set/defined, right? The only page where it is set is the Author's (author.php). If I'm not mistaken...

Share this post


Link to post
Share on other sites

Actually, I've found that the Author's page (such as /authors/lewis.carroll etc...) also generates varous Notices because of the "missing cover image" and also because of if(!$title), if (!$description) and others.

 

Share this post


Link to post
Share on other sites

I should check those.

What version of php are you using?
What is your config for error reporting?


Thanks :)

  • Like 1

Share this post


Link to post
Share on other sites

I use PHP 5.6.10. I always set E_ALL in a development/testing environment (this is the case right now) so that I can tackle anything that is being reported :)

Share this post


Link to post
Share on other sites

I was using PHP 7.x
maybe thats why I didn't see those errors.

I'll check with 5.6.

  • Like 1

Share this post


Link to post
Share on other sites

I hope now it does not shows any more warnings :P

Please get the latests changes in the github repo 

thanks :)

Share this post


Link to post
Share on other sites

No sign of any warning/notice anymore. Thanks a lot! I will probably turn this profile into a Foundation 6 based "base profile" of mine, in order to jump start my future projects.

  • Like 1

Share this post


Link to post
Share on other sites

@clsource I found that namespace Processwire; is missing form _main.php which can lead to Fatal Error when the compilation setting of a template is set to either Yes (template file only) or No (disabled compiler).

Share this post


Link to post
Share on other sites

The thing I love about my Ghost blogs is the writing UI: Write Markdown on the left, and it appears fully rendered on the right. It also has the coolest while-you-write image upload utility I've ever seen.

That's not covered by pw-ghost, right?

Not having Ghost's writing UI isn't a deal-breaker, and I can't wait to try this out. If I could replace my Ghost blogs with a ProcessWire equivalent, I'd love to forgo the chore of maintaining a Node server!

Share this post


Link to post
Share on other sites
1 hour ago, johnstephens said:

That's not covered by pw-ghost, right?

Sure, it's a gfx only design clone to demonstrate @clsource's Wire Render Pattern: 

 

 

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, johnstephens said:

The thing I love about my Ghost blogs is the writing UI: Write Markdown on the left, and it appears fully rendered on the right.

Gee, this part sounds familiar ;)

  • Like 3

Share this post


Link to post
Share on other sites

 This does also have a side-by-side view (at-least in fullscreen mode). I think it's even configurable.

  • Like 1

Share this post


Link to post
Share on other sites

yes, it works on default theme (needs some CSS adoration on Reno)

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Violet
      Here I'm writing up about my first ProcessWire site, Reached.space, a blog and directory about shops which offer international shipping. 
      I'm from The GrayFly Group, which is the registered trade name for GrayFly Stationery, LLC, a limited liability company registered in the state of Kentucky, USA. You might ask, why is a stationery company creating websites?! Well, in a way both activities are very similar: both activities have the goal of getting written messages across in a pleasing manner to the reader.
      With that out of the way, let's move on and explain what went on behind the scenes of the Reached.space site:
      Template
      I used a free CSS-based template from W3CSS at https://www.w3schools.com/w3css/w3css_templates.asp , using mainly the "Architect" template as the basis and modifying it as needed.
      Pagination
      The pagination feature of ProcessWire was very helpful here; I kept the home page to just two blogroll articles so that the reader was not overwhelmed, but upon pressing "more articles" the remainder of the blogroll is paginated with 4 articles to a page.
      Screen reader
      I made adjustments to my usage of the template to make it screen-reader-friendly. I used the Google Chrome extension to test out how the site would be handled with a screen reader.
      Security
      Security is always important, so I was thrilled to find a great all-in-one-place security guide in the ProcessWire docs at https://processwire.com/docs/security/ - I simply went through the guide and did what it said, using it as a checklist.  
      Modules
      As far as I'm aware, the only additional modules I used (that were not already activated by default in standard PW install) were the Upgrade and Upgrade Checker modules. The main reason for this was security considerations, but it was also an added convenience and peace of mind to have it check for updates every time I logged in.
      However, I did use additional software that was not modules, as described below.
      Other software - Simple HTML DOM
      Here I was very fortunate to receive help from the ProcessWire community on the forum. Due to the site's monetization model being affiliate marketing, I wished to make all my external links nofollow and target _blank by default. User @Robin S was instrumental in showing me how to do this using Simple HTML DOM in the forum post  https://processwire.com/talk/topic/17295-solved-how-to-make-external-links-nofollow-and-target-_blank-by-default-if-using-source-code-toggle-in-editor/
      Other software - Google Analytics cookie manager
      My site requirements for GDPR were specific enough that I felt I would rather develop my own code to handle Google Analytics tracking, which I'll describe here. I wanted to be certain GA tracking was disabled by default requiring opt-in, instead of opt-out. I also included in the Cookie Manager some written info about third party cookies (these are placed when clicking on affiliate links) and how the user can avoid such tracking (turn off third party cookies in their browser settings). 
      I also disabled front-end PW cookies as described here: https://processwire.com/talk/topic/15270-session-storage-and-lifetime/ 
      Google Analytics cookie settings
      The Google Analytics cookie setting code was done using JavaScript. I used a session storage variable to indicate whether the user had a) accepted GA tracking cookies b) declined them or c) had not made a choice yet. I also had to make some changes also to the <head> code to ensure Google Analytics cookies were not set unless the user had accepted them. 
      Efficiency - optimizing 404s
      I used the guide at https://processwire.com/blog/posts/optimizing-404s-in-processwire/ to sinkhole bot-driven 404 requests to a static 404 file. 
      Back office pic
      Below is an image of how ProcessWire allows helpful field descriptions and displays them when used in templates, so that when I come to actually use or enter content in fields I created months ago, I know what the ramifications are. Very helpful. Also, when using the back office I found the Reno admin theme to be very pleasing, efficient, and easy to use.

       
    • By sam-vital
      Hi,
      I'm creating a News/Updates section for a client and they would like the 3 most recent Updates previewed on the home screen. So this would be Title and Date Posted. These blog posts will be child pages of a News and Updates page, which is a child of the Home page. So it's like Home -> News -> Blog posts. I don't need this to be a nav menu, just something to show the newest updates.
      All help is appreciated 🙂
    • By EyeDentify
      I as have been a bit confused for some time about how the "Markup Regions" functionality in Processwire worked.
      But i have know read a bit more and think that i am getting to grips with it. And Markup Regions is going to be huge.

      To aid me in understanding Markup Regions better i started to read the Source code for the new "Regular" theme in conjunction with the Blog about the markup regions.
      It helped me a great deal to understand the basics and more fine details of it.

      A tip is to open both links and use the Source code of the "Regular" theme while reading the blog post.
       
      The Source code:
      https://github.com/processwire/processwire/blob/dev/site-regular/templates/_main.php
      The Blog post:
      https://processwire.com/blog/posts/processwire-3.0.62-and-more-on-markup-regions/
       
      I hope this could help others starting out with markup regions.
      Just take it slow and read it a couple a times and soon you will see the greatness of markup regions.

      /EyeDentify 
    • By EyeDentify
      Hello Fellow PW Fans and Gurus.

      I have run into a problem where i have created a template without a template file associated with it.
      Now i would like to HAVE a template file associated with it, not an alternate but as the main template file.

      So i thought, that's easy, I upload the template file and change it in template settings but I only get the Alternate template file setting?

      Ok so maybe i can change it via the API , so i wrote some code for this.
      <?PHP function changeTemplate($pages = null, $templates = null) { /* get the pages to change template on */ $logItems = $pages->findMany('template=tmp_log_item'); /* get the template object for our desired template */ $Template = $templates->get('tmp_new_log_item'); foreach($logItems AS $key => $logData) { /* use template object $Template to set template */ $logData->template = $Template; /* save page item */ $logData->save(); } } /* do the magic change */ changeTemplate(); ?> Needless to say, PW was not happy about this, It throw up an error message:
      Error: Exception: Invalid value sent to Page::setTemplate (in /home/virtual/mydomain/public_html/wire/core/Page.php line 1782)
      Now from what i understand i gave $logData->template the wrong type of value.
      So what should the value be to correct this?
      When I read the docs at: https://processwire.com/api/ref/page/
      the value can be "string" or "Template".

      So i gave it a string and it went haywire.

      How should I approach this cause I realy dont want to manually change template file on över 50 plus pages

      Maybe I should use the Template class to create the value that the API wanted, but I am unsure how to use it.

      Thank you for any info you can give me on this.

      If you want more info to help me, ask and I will try my best to give it to you.
      Updated and Solved
      I solved the problem and have updated the code to reflect this.

      Essentialy i used the get() method of $templates to get the template object for my template i wanted to use using the template name.
      I gave the Object to the $logData->template property and all went well.
      We learn something new every day.
      One Note:
      The template file you want to use must have been uploaded and added as a template in the Template section in the Admin for this code to work as expected.
    • By franciccio-ITALIANO
      Hi, in wordpress homepage we can put a list of LAST ARTICLES AND COMMENTS.
      Can I do same thing with processwire?
      If yes, how?
      There is a tutorial?

      Thanks!