-
Posts
533 -
Joined
-
Last visited
Everything posted by adrianmak
-
How could I assign specific admin page for user role?
adrianmak replied to adrianmak's topic in General Support
Ya.....just two lines of code and done public static function getModuleInfo() { return array( 'title' => 'Process Module (basic example)', 'summary' => 'A very simple process module as an example on how easy they are to create.', 'version' => 100, 'href' => '', 'permission' => 'form-submit-view', /* permission required */ 'permissions' => array( 'form-submit-view' => 'Form submission result.' ) /* install new permission */ ); } -
There is a user role which is used for content editing. In my local testing, contact form submission result will be stored as page and use admin process to display the result. Since the admin process all bind to a admin template, if I give rights to a user role, all other admin page will be view by that role. And this is not I wanted to. How to give access rights for a admin process, in my case, is the form submission result Editor role access pages only I want the Editor role able to access the form result
-
how to implement a free tagging for pages/content ?
-
Form Validation With Valitron Library
adrianmak replied to Marek's topic in Module/Plugin Development
Why not to use js client side for form validation ? -
You are using the year/month/ in the archives URLs only while your posts have 'normal' URLs. <----- Yes, it is.
-
After two days work, my roughly code is working as I desired. I did think, I'm not require to re-built a url for each blog post. Instead, I intended for making a wordpress like archive widget, Here it is
-
As u said, if option 2 or 3 is selected, date and time will be shown. Then, is it a bug on option 1? leave it for pw core developer think about it.
-
Full working code I used following lipsum php generator https://github.com/alexscottmoore/Lorem-PHPsum <?php include "lorem-phpsum.php"; include('index.php'); $startdate = "2013-01-01"; $enddate = date("Y-m-d H:i:s"); echo "Generate dummy blog post"; for ($i=1;$i<=30;$i++) { $blog = wire('pages')->get('/blog'); $p = new Page(); $p->template = 'post'; $p->parent = $blog; $p->title = phpsum(5); $p->body = phpsum(10, 20, 3); $p->post_date = randomDate($startdate, $enddate); $p->of(false); echo "Saving post...."; foreach($wire->languages as $lang) { if($lang->isDefault()) continue; $p->set("status$lang", 1); $p->save(); } } function randomDate($start_date, $end_date) { // Convert to timetamps $min = strtotime($start_date); $max = strtotime($end_date); // Generate random number using above bounds $val = rand($min, $max); // Convert back to desired date format return date('Y-m-d H:i:s', $val); } ?>
-
it didn't work. I found that the $languages variable is not available on my php script. it is a NULL value since this is my custom php script, run outside of pw. the $languages variable should be changed to $wire->languages Then the snippet code will work in this case
-
adrian and apeisa's way both work. Another question, how to active another language of a page in api ? Right now, my code is not active another language by default.
-
I have this field set. But when add a new page, the post_date field populated from today date is still shown date only, no time
-
I'm writing snippet of code to generate dummy content. For the most basic, I tried to create a page to make sure it is working. <?php /* include pw bootstrap*/ include('index.php'); echo "generate dummy content"; $p = new Page(); /* page template */ $p->template = 'post'; /* parent template */ $p->parent = 'blog'; $p->title ="create page in api"; $p->body = "dsdsd sd sd sd s d ss"; $p->post_date ="2015-01-26"; $p->save(); ?> however, Error: Uncaught exception 'WireException' with message 'Unknown Selector operator: '' -- was your selector value properly escaped? ' in /var/www/html/pw1/wire/core/Selectors.php:247 Stack trace: #0 /var/www/html/pw1/wire/core/Selectors.php(284): Selectors->create('blog', '', '') #1 /var/www/html/pw1/wire/core/Selectors.php(81): Selectors->extractString('blog') #2 /var/www/html/pw1/wire/core/Pages.php(165): Selectors->__construct('blog') #3 [internal function]: Pages->___find('blog', Array) #4 /var/www/html/pw1/wire/core/Wire.php(389): call_user_func_array(Array, Array) #5 /var/www/html/pw1/wire/core/Wire.php(344): Wire->runHooks('find', Array) #6 /var/www/html/pw1/wire/core/Pages.php(260): Wire->__call('find', Array) #7 /var/www/html/pw1/wire/core/Pages.php(260): Pages->find('blog', Array) #8 /var/www/html/pw1/wire/core/Pages.php(275): Pages->findOne('blog') #9 /var/www/html/pw1/wire/core/Page.php(400): Pages->get('blog') #10 /var/www/html/pw1/wire/core/Page.php(820): Page->set('parent', 'blog') #11 /var/www/html/pw (line 247 of /var/www/html/pw1/wire/core/Selectors.php) This error message was shown because you are logged in as a Superuser. Error has been logged.
-
I'm sorry. I tried all possible field settings, but the default value still only show a date only.
-
As you suggested, I added a post date on blog post template. However, the default value only show the date, how to default both date with time ?
-
My code (very rough) is almost done. But I have to need more posts in different date & time for testing. Any how to alter posts date ?
-
For learning purpose, I will try to write my own code
-
For testing my code, is it possible to alter post's date to older date ?
-
could I use by year in selecting pages? For example, to get all post of year 2014 $page = $pages->get("template=post, created=2014, name={$name}");
-
I just read thru the url segments documentation. It given example of url segments are appended on actual url. My case is opposite. url segments is prepended of a actual url.
-
I'm wondering this method is not quit user friendly, user have to create month, day page before create a blog post. I think Pierre-Luc way is the right direction instead.
-
could u give some direction on how to structure pages like that ?
-
By no doubt, wordpress is the greatest blogging platform. The auto archive feature is good for a blog site. How to implement in processwire, such that the page's (blog post) url is something like in wordpress, prefix by date for instance, http://mysite/2015/01/05/page-title-name
-
regarding saves form as page of FormTemplateProcessor module
adrianmak replied to adrianmak's topic in General Support
ok thanks. I'll take a look on process module