Execute a job to add new page
Permalink 1 user found helpful
Hello all,
I want practice "Adding a New Page Programmatically", but my job can't create my test page.
Thank you for help.
I want practice "Adding a New Page Programmatically", but my job can't create my test page.
<?php namespace Application\Job; use \Job as AbstractJob; class AddPortfolio extends AbstractJob { /** Returns the job name. * @return string */ public function getJobName() { return t('add page Portfolio'); } /** Returns the job description. * @return string */ public function getJobDescription() { return t('Load my portfolio');
Viewing 15 lines of 31 lines. View entire code block.
Thank you for help.
Thanks a lot. I add it but doesn't work :-(
namespace Application\Job; use \Job as AbstractJob; use Concrete\Core\Cache\Cache; /*here my code*/
Did you make sure to remove
Cache::disableLocalCache()
Yes. and doesn't work.
namespace Application\Job; use \Job as AbstractJob; use Concrete\Core\Cache\Cache; class AddPortfolio extends AbstractJob { /** Returns the job name. * @return string */ public function getJobName() { return t('add page Portfolio'); } /** Returns the job description. * @return string */ public function getJobDescription() { return t('Load my portfolio');
Viewing 15 lines of 29 lines. View entire code block.
EDIT: Try changing to
http://documentation.concrete5.org/api/class-Concrete.Core.Cache.Ca...
What happens when you run the job? Does it throb forever? Does it complete and display a message when it's done? Which version of the 5.7 branch are you using?
I figured out what was wrong by running `tail -f /path/to/error-log` on my server.
Could you try that as well?
Cache::disableCache();
Cache::disableAll();
http://documentation.concrete5.org/api/class-Concrete.Core.Cache.Ca...
What happens when you run the job? Does it throb forever? Does it complete and display a message when it's done? Which version of the 5.7 branch are you using?
I figured out what was wrong by running `tail -f /path/to/error-log` on my server.
Could you try that as well?
Thank you very much for your support. when I change DisableCach() to disableAll(), my job run correctly. (I'm very happy)
I'm a beginner developper for concrete5, and now I use last version 5.7.5.6
presently I try to develop short code in order to understand concrete5. but when I have error, the system doesn't display it, even if I activate it in debugging setting, its like I dont have error.
My goal is read xml file and create a new pages :-)
I will continue to evolve my code and coming back to you
I'm a beginner developper for concrete5, and now I use last version 5.7.5.6
presently I try to develop short code in order to understand concrete5. but when I have error, the system doesn't display it, even if I activate it in debugging setting, its like I dont have error.
My goal is read xml file and create a new pages :-)
I will continue to evolve my code and coming back to you
I'm back,
I want to read the xml file and create a new page but my code can't create it. I think I have probleme with namespace or other.
add_portfolio.php
portfolio.xml
Thanks for help.
I want to read the xml file and create a new page but my code can't create it. I think I have probleme with namespace or other.
add_portfolio.php
<?php namespace Application\Job; use \Job as AbstractJob; use Concrete\Core\Cache\Cache; use URLify; class AddPortfolio extends AbstractJob { /** Returns the job name. * @return string */ public function getJobName() { return t('add page Portfolio v2'); } /** Returns the job description. * @return string */
Viewing 15 lines of 38 lines. View entire code block.
portfolio.xml
<?xml version="1.0" encoding="UTF-8"?> <ERRORCODE>0</ERRORCODE> <RESULTSET FOUND="2"> <ROW RECORDID="1"> <COL><DATA>1</DATA></COL> <COL><DATA>Markdown</DATA></COL> <COL><DATA>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla consectetur enim eget eros accumsan, </DATA></COL> <COL><DATA>http://www.test.com</DATA></COL> </ROW> <ROW RECORDID="2"> <COL><DATA>2</DATA></COL> <COL><DATA>Ticks</DATA></COL> <COL><DATA>Curabitur nec convallis enim. Proin maximus tortor vitae sodales auctor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla in dui tortor. </DATA></COL> <COL><DATA>http://www.other-test.com</DATA></COL> </ROW>
Viewing 15 lines of 17 lines. View entire code block.
Thanks for help.
Also, you need to add
use Concrete\Core\Cache\Cache;