Jump to content

picarica

Members
  • Posts

    63
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

picarica's Achievements

Full Member

Full Member (4/6)

7

Reputation

  1. yes the title updates everything else updates but title only updates if its empty before saving, thats the issue
  2. so i started recently working on hooks i makde hook that after page create i upload .xml file and from that i get title into variable and i paste it into name(url) and title, the name(url) is replaced but title isnt? why is that i have it like this $page->title = $newtitle; $page->name = $newtitle; and i have that in $this->addHookAfter('Pages::saveReady', function(HookEvent $event) { // Get the object the event occurred on, if needed $pages = $event->object; // An 'after' hook can retrieve and/or modify the return value $return = $event->return; // Get values of arguments sent to hook (if needed) $page = $event->arguments(0); // tento hook pojde len na jeden template if($page->template != 'hry_home') return; // pokail stranka este neni vytvorena (Nema ID) tak nepokracuj zo scriptom if(empty($page->id)) return; these are also my if statements so that it doesnt run off when it shouldn't, also this is in my ready.php file so question is how ca ni force to overwrite my title field ? after save
  3. wow that worked, but why, i kinda dont get it? root of children dont get change when on child url, why did it worked?
  4. Hello so i managed to implement pagination to my site, i have navigation rendering done like so $out = ''; $root = $pages->get("/"); $children = $root->children("limit=150"); // $children->prepend($root); foreach($children as $child) { if($child->numChildren && $child->id !== 1) {// @note: you could do some more checks here; $out .= "<li>"; $out .= "<a class='dropdown' href='javascript:void(0);'>{$child->title}</a>"; $out .= "<ul>"; foreach($child->children as $level1) { if ($level1->hasChildren()) { $out .= "<li>"; /* if ($level1->numChildren()) { $out .= "<a href='{$level1->url}'>{$level1->title}</a>"; $out .= "<ul>"; foreach($level1->children as $level2) { $out .= "<li>"; $out .= "<a href='$level2->url'>$level2->title</a>"; $out .= "</li>"; } $out .= "</ul>"; } else { */ $out .= "<a href='{$level1->url}'>{$level1->title}</a>"; /* } */ $out .= "</li>"; } } $out .= "</ul>"; $out .= "</li>"; } else { $out .= "<li><a href='{$child->url}'>{$child->title}</a></li>"; } } echo $out; echo "<li><a href='{$root->url}'>{$root->title}</a></li>"; which works flawlessy for my page withing children any page, except when i enter pagination the whole menu entry dissapears as i click link to page2 in pagination, idk why but when my url is www.page.sk/page2/ my navigation dissapears except the last entry which is echo "<li><a href='{$root->url}'>{$root->title}</a></li>"; i tried debugging it and i found out that variable $children is just empty like why would $root->children("limit=150"); wouldn't work in url segment? is this some sort of bug ?
  5. no i wasnt aware of -> not() functinon this works fine i found out one workaround by myself i checked if field which as every page isnt empty but this is very good solution thanks $kat = $pages->find("subor_hry>1, $limiter");
  6. so i want to $pages->find find pages only that dont have children i didnt see any options for this so i tried this $kate = $pages->find("template=hry_home"); foreach ($kate as $bruh) { if($bruh->hasChildren()) { $kate->remove($bruh); } } this works incredibly good but i need it for pagination so i still need to limit it and thats where i got stuck simply $kat = $pages->find("$kate ,limit=5"); doesnt work, how do you work around this problem? every page has the same template, so i cannot use just different selector in find command are there any other quirsk i could use ?
  7. i have been trying this for a while and what even is imageSizer? is it like a hook ? if so i get error everytime i try ti save it ProcessPageEdit: Unable to read: /site-hry/assets/files/1027/flash_fishy_screenshot.png and when i put it into template i get different error do i understand it incorrectly ? i have this setup $word = ".png"; foreach($page->subor_hry as $file) { if(strpos($file, $word) !== false){ $image = new Pageimage($page->images_thumb, $file->url); } }
  8. So hello i am trying to get a .png file from file field and put it automatically to image field, why png image is in the file field is because i already have a hook that extracts .zip and uploads all content into file field, but i just realizes i cant use size() function on image in file field so i am tryin got reupload it to images field i already have something like this in ready.php $word = ".png"; foreach($page->subor_hry as $file) { if(strpos($file, $word) !== false){ $page->images_thumb = $file->url; } } by my logic it should work but it dosnt i get error ProcessPageEdit: Unable to read: /site-hry/assets/files/1027/flash_fishy_screenshot.png when i remove url from $file->url i just get ProcessPageEdit: Item added to ProcessWire\Pageimages is not an allowed type so what am i doing wrong? is there some other way to do this ? also can i have all this in $this->addHookAfter('Pages::saveReady', function(HookEvent $event) { whats the correct function to have it apply on all pages ?
  9. ye welp, its still an image, so ill probably have to make some sort of hook to put image into image field and then output them, well thanks for confirmation
  10. so hello there i have fiel field type i have lots of stuff there, and also an image i can easily get image from that field using $options = array('quality' => 85, 'upscaling' => true, 'cropping' => 'north', 'sharpening' => 'medium'); $word = ".png"; // Test if string contains the word foreach($childgames->subor_hry as $file) { if(strpos($file, $word) !== false){ /* $imger = $file->size(473, 266, $options); */ echo $file; /* echo $file->url; */ } } so i get the fiel i tried invoking size on it like the commented out part and it doesnt work i get error Oh snizzle… Error: Exception: Method Pagefile::size does not exist or is not callable in this context (in what am i doing wrong? can you guys help me by all logic this should work
  11. so what i am trying to do is that i uploded some files into file field, and then i want hook to get MD5sum and other stuff from .xml and put it into text field into it coresponding pages, pages like this are gonna be many, for each one i want it to output it into its fields
  12. oh nevermind i gues this works ? if($media->r_soc->title == 'facebook') { $soc = 'facebook'; } elseif($media->r_soc->title == 'twitter') { $soc = 'twitter';
  13. so i made some options in t he field type, and i want to check if selected title is that output this is my sample code if($media->r_soc == 'facebook') { $soc = 'facebook'; } elseif($media->r_soc == 'twitter') { $soc = 'twitter'; } i just basically want to check if the user in CMS selected option facebokk and then outpit it into variable which is later outputted into fa icon, oh and also this is all in repeat field foreach($ikonky as $media) { so thats why its $media, but as of now it outputs blank state, not sure why, it doesnt outpit anything none of the check goes throught these are options i have in the field 1=facebook 2=twitter 3=instagram 4=youtube 5=github 6=linkedin
  14. well, no it doesnt help, beacuse its in CKEDITOR, the text in the same editor is visible, but not the images, and the image filed where the iamges are uploaded is visible on the page but not when embeded into ckfield
  15. so this is really weird issue i am so confused about this, so i have setup 'images' field where i put images and the include them in CKeditor, should work right? well it works on some sites, i use it nearly in every page but at one page, the images included in that CKeditor only show up, when i am logged into processwire, when i turn on incognito mode the images dissapear, but only on this specific page, everywhere else it works perfectly, has anyone came across this issue? i have nowhere in the site login checker, i have no idea what is going on
×
×
  • Create New...