Jump to content

leoric

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by leoric

  1. Thanks,Ryan This is a great news! But Chinese characters still not working, Could you provide example whitelist for the example URL?
  2. Is there anybody trying to use Ajax and JSONP in PW? here is my code, but it does not working. it looks like "$config->ajax" didn't work. Client: $(function(){ $.ajax({ type: "GET", async: false, url: "http://localhost/processwire/", dataType: 'jsonp', jsonp: "callback", jsonpCallback: "jsonpCallback", success: function (data) { $.each(data,function(i,val){ $("body").prepend(i + ' ' +val.fullName + ' ' + val.fullAdress + '<br>'); }); }, error: function(){ alert('fail'); } }); }); Server: if($config->ajax) { $array = array( '0' => array('fullName' => 'Meni Samet', 'fullAdress' => 'New York, NY'), '1' => array('fullName' => 'Test 2', 'fullAdress' => 'Paris'), ); if($input->get->callback) { header("Content-Type: application/json"); echo $input->get->callback."(".json_encode($array).")"; } } else { include("./basic-page.php"); }
  3. hi @horst : i want to add a watermark for page image. and use this module then got an error: Error: Call to a member function pimLoad() on a non-object this caused error: $img = $page->images->first(); $wmi = $page->watermark->pimLoad('wmi')->colorize('red')->pimSave(); $imgsrc = $img->pimLoad('tw',true)->width(180)->grayscale()->watermarkLogo($wmi, 'southeast', 0)->pimSave(); echo "<img src='{$imgsrc->url}' /><br />"; i use this,its works well, i found the new image be created: $img = $page->images->first(); $imgsrc = $img->pimLoad('myPrefix')->setOptions($options)->width(300)->pimSave(); echo "<img src='{$imgsrc->url}' /><br />";
  4. i have a repeater field named 'q_items'. the repeater 'q_items' have a PageArray field named 'products'. and now i want search by products field's title. //category A --------------------------------------------------------------------- Page A: ----title ----q_items --------products = PageD (the page's title contain 'processwire',PageA will be show in the search result) Page B: ----title ----q_items --------products = PageE Page C: ----title ----q_items --------products = PageF (the page's title contain 'processwire',PageC will be show in the search result) //category B ---------------------------------------------------------------- Page D ----title = "i love processwire" ----body Page E ----title= "i love this world" ----body Page F ----title= "hello,processwire" ----body in the sample data, when i search 'processwire' and will get PageA and PageC this is an error expression: $matches=$pages->find(q_items.products.title%=processwire) is it possible to do this?
  5. $id=$this->pages->find("include=all,sort=-id,limit=1")->first()+1; i use this instead of $id=$this->pages->find("include=all")->last()->id+1; is it ok?
  6. hi, pete thank you for your reply. finally i found the cause of this problem. this code spent too much time to execute.. $id=$this->pages->find("include=all")->last()->id+1; Is there a way to replace this? here is full code in the module: public function hookRender(HookEvent $event) { if($this->process != 'ProcessPageAdd') return; $id=$this->pages->find("include=all")->last()->id+1; //get the latest id $inputfield = $event->object; if(strlen($inputfield->attr('value'))) return; $inputfield->attr('value', $id); }
  7. hi,everyone: i have a problem. there are currently 1700 pages in my site (it have a continual trend of increases...) and now the problem is : create a new page need a long time , more than 15 seconds. whether via api or back end. the details(such as in the back end page tree create new page, any parent): when i click "new" then i have to waiting for more than 15 seconds ... after a long waiting i will see " add new " page form.( title, name and template select..) what is the problem?
  8. hi,ryan i found a issue after my test( PW 2.4) when i unstalled the module i still could found permissions in this page(i could checked the checkbox and saved): Access -> Roles -> Role Name -> edit it's looks like no uninstall clean.at last i had to deleted them in this page: Access -> Permissions is this a bug?
  9. hi,everybody: I solved the problem. its my fault,i cant describe the question clearly. but the forum is very helpful,at last i found the solution in forum. here is my test code: $q='keyword'; $matches = $pages->find("title|summary|%=$q,template=_page_show"); $uniqueResults = array(); foreach($matches as $child) { //echo $child->title.'<br>'; //get the result page's parents $uniqueResults[$child->parent->title]=$child->parent; } foreach($uniqueResults as $r) { echo '<b><a href="'.$r->url.'">'.$r->title.'</a></b><br>'; } this post is helpful to me. http://processwire.com/talk/topic/2038-distinct-selector-in-processwire/?p=19058 thank you all!
  10. diogo , i am so sorry,my english is not good. i want to do this: here is some goods in my database(such as clothes): (default search result) when i input a keyword like "Shirts",we will get all the results of the search criteria (categories:men's shirts,women's shirts,boy's chirts...etc..) and now,i want to add a navigation bar on the top of search result for better filter goods. there are some categories in the navigation bar ( men's shirts, women's shirts......),when i click men's shirts then we can get all men's shirts in the result. is this more clear?
  11. this topic is unclear. you can go to 3 and 7 floor , thank you. i have a query result $matches = $pages->find("title|summary|%=$q,template=_page_show,limit=12"); and i have a demand: find these result pages parent, then i could second search by page's parent(through click parent link and urlSegment) it's means: page tree: category A some pages.. category B some pages.. category C some pages.. category D some pages.. search result: all categories category A category B .....(if the category have search result) some pages from search.. some pages from search.. some pages from search.. the default search result is all categories $matches = $pages->find("title|summary|%=$q,template=_page_show,limit=12"); when i click category A, we could get category id by urlSegment do this query $matches = $pages->find("title|summary|%=$q,parent_id=$parent_id,template=_page_show,limit=12"); ui example: all categories category A category B ..... some pages from search..(category A's Child) some pages from search..(category A's Child) some pages from search..(category A's Child) ... now my question is how to get all search result pages parents? is there anyone have solution? thank you.
  12. hi, cstevensjr and Marty Walker thank you for your reply i have been think so before,i even think its unreasonable. but in the fact it done. baidu highly recommended webmaster build mobile website. and them made a tool to online building mobile site (siteapp.baidu.com) unfortunately our chinese language website have a large proportion of traffic from baidu search. so we have to comply with official seo suggestion. i think baidu have two independent systems(pc and mobile). i do this if there have a good solution.
  13. hi,everyone. today i have a question need help. this is my application background story: my site domain is abc.com and i need a mobile website use m.abc.com (this is a seo suggestion from baidu.com ) they are connect to same database , just have their own difference template. is anyone have any idea? thanks.
  14. wow, it's so cool.......i'm very very happy... yes,i did it. this is my first time to make a module. thank you very much,adrian .
  15. thank you,adrian , your reply is very helpful.. and thanks for ryan in here: http://processwire.com/talk/topic/1908-automatically-generating-new-page-names/?p=17887 i do this and get what i want: open "wire\modules\process\ProcessPageAdd\ProcessPageAdd.module": find this : "public function init()" and add this line $this->addHookBefore('InputfieldPageName::render', $this, 'hookRender'); then add this function in this class: public function hookRender(HookEvent $event) { if($this->process != 'ProcessPageAdd') return; $id=$this->pages->find("include=all")->last()->id+1; //get the latest id $inputfield = $event->object; if(strlen($inputfield->attr('value'))) return; $inputfield->attr('value', $id); } ok,that's all. thank you everyone!
  16. name* Any combination of letters (a-z), numbers (0-9), dashes or underscores (no spaces). i use chinese language, i have to translated page title to english every time. its a problem for me if it could be this? when i dont type anything in this option system automatic insert the id(the last page id +1 ) is there have some solutions? thank you.
  17. http://processwire.com/api/variables/page/ you can use : $page->next / $page->prev try this: <?php if($page->next->id){ echo "<class='jscroll-next'><a href='{$page->next->path}'><span>Next</span></a>"; } ?>
  18. if current user is admin if($user->isSuperuser()){ //load admin template layout } else{ //load visitor template layout }
  19. welcome be PWer! config admin URL: as admin login backend : page tree -> admin -> edit -> setting -> name -> save --------------------------------------------------------------------------------------------------------------------- add a template: go to document directory -> /site/templates/ add a new template file "demo.php" ( some content....) go to admin backend : setup -> templates -> add new templates ( the system will find "demo.php") -> checked -> add templates then go back , in "setup->templates" you can see "demo.php" , click "demo.php" in templates list, then you can manage fields for this template. how to use? page -> edit -> setting -> template -> in the templates list you can see " demo " --------------------------------------------------------------------------------------------------------------------- these modules are helpful for you. http://modules.processwire.com/modules/ trust me , PW is a good choice. in the fact,pw not only as a cms, more like a framework, if you are a phper , you will love it even more ... my english comprehension limit. if this helpful?
  20. @soma ,your reply is very helpful... my fault: $app is a page id variable, not a $page object. $removepage = $pages->get($app); -> add this line $user->user_app->remove($removepage); ->change removeall to remove its working thank you very much!
×
×
  • Create New...