phly / phlyblog Goto Github PK
View Code? Open in Web Editor NEWLaminas MVC module for creating a static blog.
License: BSD 2-Clause "Simplified" License
Laminas MVC module for creating a static blog.
License: BSD 2-Clause "Simplified" License
hello, @weierophinney. I would appreciate it if you can migrate this package as this package provide me some use case for static site generator kind of concept and this helps to keepLaminas
is my first priority for development.
tried this package, copied sample-posts.php to ./data/posts then ran php public/index.php compile -a and got this error.
file and line number is:
Development\php\myZf2Test\vendor\phly\phly-blog\Module.php on line 54
I correctly compiled the sample-post.php entity and it generated a a public/blog folder with"
author/
day/
month/
tag/
year/
Example-Blog_post.html
I can view the Example-Blog_post.html by URL, but how do I view the paginated entry files that you would typically see on the front page of a blog?
Hello @weierophinney I tried two test cases.
(1) Without any file class or factory overriden
(2) Using delegators whichi is calling setEventManager
method twice
@weierophinney: Any idea why I am getting this exception?
Compiling and sorting entries======================================================================
Exception
/Users/jkershner/Documents/Projects/Personal/goferhost.dev/vendor/phly/phly-common/src/PhlyCommon/Filter/Timestamp.php:23
#0 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/vendor/phly/phly-common/src/PhlyCommon/Filter/Timestamp.php(23): DateTime->__construct()
#1 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/vendor/phly/phly-blog/src/PhlyBlog/EntryEntity.php(234): PhlyCommon\Filter\Timestamp->filter(1300744335)
#2 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/data/blog/sample-post.php(19): PhlyBlog\EntryEntity->setCreated(1300744335)
#3 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/vendor/phly/phly-blog/src/PhlyBlog/Compiler.php(60): include('/Users/jkershne...')
#4 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/vendor/phly/phly-blog/src/PhlyBlog/CompileController.php(233): PhlyBlog\Compiler->compile()
#5 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php(82): PhlyBlog\CompileController->compileAction()
#6 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#7 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#8 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#9 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php(118): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#10 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php(93): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Console\Request), Object(Zend\Console\Response))
#11 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#12 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#13 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#14 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(313): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#15 /Users/jkershner/Documents/Projects/Personal/goferhost.dev/public_html/index.php(26): Zend\Mvc\Application->run()
#16 {main}
Previous Exception(s):
I am able to get this to work perfectly by modifying the view phtml files and adding the site's templates directly into these files (where appropriate).
Is there a way to have this use the main Application's layout.phtml template? I tried added a layout/layout in the view manager's template map:
'layout/layout' => DIR . '/../view/phly-blog/layout.phtml',
... but the blog.html file just renders the
When i execute blog compile --all, the first entry appear twice into the blog list
i putted a breakpoint in the Compiler::compile() line 60.
I have 2 files into data/blog but the loop is repeated 3 times
@weierophinney I am trying to run this package using https://github.com/laminas/laminas-mvc-skeleton/tree/2.4.x
it is not compiling files. Can you please look into this.
Hello @weierophinney
I am simply using this compile command and it give me bellow error.
./vendor/bin/laminas phly-blog:compile
Few file I debug and found one issue relate to layout.
(1) Removal of code from master layout (layout.phtml)
<link rel="canonical" href="<?=$this->url('home', [], ['force_canonical' => true]); ?>" />
If I remove above line from layout.phtml ( which is master layout ) then it will work as expected. I don't know what is wrong with this.
(2) Removal of config from config.php file
'base_path' => '/',
'base_url' => '/',
If I remove above line from module config then it has no effect on error.
Would you like to help or give any hint on issue. much appreciated
I try to use this package with fresh installation of laminas-mvc-skeleton everything works perfect except this error @weierophinney or @rieschl Do you have any ides why $listener is not getting this compile method
I tried to debug more on this and found that, While entries by tag is compiled at that time $listener become null.
I see how to render all tags from a particular blog article, but is there a way to render all tags from all articles to create a master tag cloud for the entire blog?
@weierophinney It look like delegator can't able to intercept compiler command , I am thinking that compiler is not invoked by factory this might be the case.
Matthew, thanks for writing this blog module!
I'm still fiddling with it in my spare time and encountered what appears to be some kind of configuration error. If I navigate to http://SomeImplementationOfThisBlogModule.com/Some_Missing_Page The status code being provided is a 200 OK. I would expect 404 response code. It looks like the module.config.php file does include reference to a 404 handler; however, something is a bit funky -- as it is sending that bugger of a 200 OK no matter what.
module.config.php -- Lines 47-59:
'router' => array(
'routes' => array(
'default' => array(
'type' => 'Regex',
'options' => array(
'regex' => '/.*',
'defaults' => array(
'controller' => 'PhlySimplePage\Controller\Page',
'template' => 'pages/404',
),
'spec' => '404',
),
),
Looking at PhlySimplePage/PageController.php Lines 159-193 seem to imply that a 404 would be generated... but for some reason it isn't. Any ideas?
I've added this module to composer.json
and installed. Then, I created data/posts
and data/blog
. Both have writing and reading access for www
. I've copied the sample-post.php
to data/posts
and then ran php ./public/index.php blog compile
. The following was my output:
rwoverdijk$ php ./public/index.php blog compile
Compiling and sorting entriesPHP Catchable fatal error: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in /Library/WebServer/Documents/packages/PhlyBlog/src/PhlyBlog/Compiler/Listener/Archives.php on line 28
PHP Stack trace:
PHP 1. {main}() /Library/WebServer/Documents/spxbeta.dev/public/index.php:0
PHP 2. Zend\Mvc\Application->run() /Library/WebServer/Documents/spxbeta.dev/public/index.php:12
PHP 3. Zend\EventManager\EventManager->trigger() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php:297
PHP 4. Zend\EventManager\EventManager->triggerListeners() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:208
PHP 5. call_user_func() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
PHP 6. Zend\Mvc\DispatchListener->onDispatch() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
PHP 7. Zend\Mvc\Controller\AbstractController->dispatch() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php:113
PHP 8. Zend\EventManager\EventManager->trigger() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php:107
PHP 9. Zend\EventManager\EventManager->triggerListeners() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:208
PHP 10. call_user_func() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
PHP 11. Zend\Mvc\Controller\AbstractActionController->onDispatch() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
PHP 12. PhlyBlog\CompileController->compileAction() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php:88
PHP 13. PhlyBlog\Compiler->compile() /Library/WebServer/Documents/packages/PhlyBlog/src/PhlyBlog/CompileController.php:233
PHP 14. Zend\EventManager\EventManager->trigger() /Library/WebServer/Documents/packages/PhlyBlog/src/PhlyBlog/Compiler.php:85
PHP 15. Zend\EventManager\EventManager->triggerListeners() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:208
PHP 16. call_user_func() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
PHP 17. PhlyBlog\Compiler\Listener\Archives->onCompileEnd() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
Catchable fatal error: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in /Library/WebServer/Documents/packages/PhlyBlog/src/PhlyBlog/Compiler/Listener/Archives.php on line 28
Call Stack:
0.0002 226160 1. {main}() /Library/WebServer/Documents/spxbeta.dev/public/index.php:0
0.0351 3092120 2. Zend\Mvc\Application->run() /Library/WebServer/Documents/spxbeta.dev/public/index.php:12
0.0359 3118688 3. Zend\EventManager\EventManager->trigger() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php:297
0.0359 3118688 4. Zend\EventManager\EventManager->triggerListeners() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:208
0.0360 3120448 5. call_user_func() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
0.0360 3120480 6. Zend\Mvc\DispatchListener->onDispatch() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
0.0445 4247760 7. Zend\Mvc\Controller\AbstractController->dispatch() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php:113
0.0445 4248480 8. Zend\EventManager\EventManager->trigger() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php:107
0.0445 4248480 9. Zend\EventManager\EventManager->triggerListeners() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:208
0.0490 4637040 10. call_user_func() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
0.0490 4637072 11. Zend\Mvc\Controller\AbstractActionController->onDispatch() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
0.0490 4637296 12. PhlyBlog\CompileController->compileAction() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php:88
0.0930 5529872 13. PhlyBlog\Compiler->compile() /Library/WebServer/Documents/packages/PhlyBlog/src/PhlyBlog/CompileController.php:233
0.0932 5540944 14. Zend\EventManager\EventManager->trigger() /Library/WebServer/Documents/packages/PhlyBlog/src/PhlyBlog/Compiler.php:85
0.0932 5541160 15. Zend\EventManager\EventManager->triggerListeners() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:208
0.0933 5543224 16. call_user_func() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
0.0933 5543256 17. PhlyBlog\Compiler\Listener\Archives->onCompileEnd() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
Alright so I have this sort-of-working but I am having a tough time consuming this blog in my application. If I update the built in views to use my own template, I can serve the /blog/blog.html directly. The title tag seems to concatenate all blogs into a single title and the feed links are duplicated as well (not sure if I am allowed to post my URL so feel free to remove it):
https://goferhost.com/blog/blog.html
I think maybe a better way to do this would be to consume this data into my existing Application module's layout by routing. Does anyone have an example of how I can do this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.