-
Posts
39 -
Joined
-
Last visited
Profile Information
-
Gender
Male
-
Location
peking,china
leoric's Achievements
Jr. Member (3/6)
12
Reputation
-
leoric started following FieldtypeHandsontable: Excel-like Inputfield
-
leoric started following Making custom application , Module that outputs a static site? , The PW (M)VC project and 5 others
-
PW 3.0.12: Support for extended (UTF8) page names/URLs
leoric replied to ryan's topic in News & Announcements
Thanks,Ryan This is a great news! But Chinese characters still not working, Could you provide example whitelist for the example URL? -
AJAX and JSONP to do cross-domain calls with ProcessWire?
leoric replied to leoric's topic in General Support
thank you,Jan , you solved my problem. -
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"); }
-
big help. @horst, thank you!
-
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 />";
-
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?
-
$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?
-
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); }
-
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?
-
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?
-
get search result pages parents(advanced search)
leoric replied to leoric's topic in General Support
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! -
get search result pages parents(advanced search)
leoric replied to leoric's topic in General Support
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? -
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.