Jump to content

picarica

Members
  • Content Count

    13
  • Joined

  • Last visited

Community Reputation

6 Neutral

About picarica

  • Rank
    Jr. Member

Recent Profile Visitors

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

  1. hello again thanks for the idea, i ended up using selectize and it's pretty good but i got stuck on 2 main issues first issue is that when i select one or more tags like this and i get nice url like this it only respects first result, i have it coded like this, so far and not sure how to make it work $alltags = array(); // container $use_urlsegments = false; // find all pages that have images with tags $parray = $pages->find("template=basic-page|art_gallery, images.tags!=''"); // loop pages found and collect tags from images foreach($parray as $p) { // find all images that have no empty tags, yeah you can // also use find on Pagefiles array! $images = $p->images->find("tags!=''"); // loop them and add tags to array foreach($images as $im) { $tags = $im->tags; // convert "," and "|" to space and create array using explode if(strpos($tags, ',') !== false) $tags = str_replace(',', ' ', $tags); if(strpos($tags, '|') !== false) $tags = str_replace('|', ' ', $tags); $tags = explode(' ', $tags); // convert tag value to a page name using beautifyer, ü => ue, ö => oe // since special chars are not allowed in PW urls foreach($tags as $tag) { $alltags[$sanitizer->pageName($tag, Sanitizer::translate)] = $tag; } } } echo "<form>"; echo "<label for='select-tag'>Tags:</label>"; echo "<select id='select-tag demo-category' required multiple class='demo-default' placeholder='Select a person...' name='tag'>"; foreach(array_unique($alltags) as $key => $tag) { if($use_urlsegments) { echo "<li><a href='{$page->url}$key'>$tag</a></li>"; } else { /* echo "<li><a href='{$page->url}?tag=$tag'>$tag</a></li>"; */ echo "<option value='$tag'>$tag</option>"; } } echo "</select>"; echo "<div>"; echo "<button style='width:100%;margin-top:1em;'type='submit'>Submit</button>"; echo "</div>"; echo "</form>"; also this is setup i have on selectize $(function() { $('select').selectize({ plugins: ['remove_button'], delimiter: ',', persist: false, create: true, sortField: 'text', allowEmptyOption: true, sortField: { field: 'text', direction: 'asc' } }); }); so not sure how to filter out by one or more tags the second issue is that when i select tag in the form, it dissapears after refresh, i am not sure how to store is somehow i researched html5 local storage but couldnt find a way for it to help me, so i wanted to know if ican somehow, search all url, find all keyword between tags= and & and input them back into the form could that be somehow possible thank you so much for help
  2. thank you so much for fixing my error it works flawlessy now. eveyrthing else to do is now make that if no tags are select show all images which i tried like this if ($input->urlSegment1 == 'tag'){ $tag = $input->get->text('tag'); $found = $pages->find("images.tags~=$tag"); foreach($found as $p){ $imagesWithTag = $p->images->findTag($tag); foreach($imagesWithTag as $image){ $options = array('quality' => 70, 'upscaling' => true, 'cropping' => 'center', 'sharpening' => 'medium'); $thumb = $image->size(400, 300, $options); $large = $image->size(1200, 0, $options); echo "<div class='col-4'>"; echo "<span class='image fit'>"; echo "<a href='$large->url'>"; echo "<img src='$thumb->url' alt='$image->tags'>"; echo "</a>"; echo "</span>"; echo "</div>"; } } } else { $pa = $pages->find("has_parent!=2,id!=2|7,status<".Page::statusTrash.",include=all"); foreach ($pa as $p) { foreach($p->images as $image) { $options = array('quality' => 70, 'upscaling' => true, 'cropping' => 'center', 'sharpening'=>'medium'); $thumb = $image->size(400, 300, $options); $large = $image->size(1200, 0, $options); echo "<div class='col-4'>"; echo "<span class='image fit'>"; echo "<a href='$large->url'>"; echo "<img src='$thumb->url' alt='$image->tags'>"; echo "</a>"; echo "</span>"; echo "</div>"; } } } but it didnt worked, now it show always shole gallery my second objective it to somehow select one or more tags and show only images having those 2 tags i already have images that has two or more tags, so i only need to implement it in php Thank you so much
  3. hello this looks very promising so i tried it, before i inputed all images like this $pa = $pages->find("has_parent!=2,id!=2|7,status<".Page::statusTrash.",include=all"); foreach ($pa as $p) { foreach($p->images as $image) { $options = array('quality' => 70, 'upscaling' => true, 'cropping' => 'center', 'sharpening'=>'medium'); $thumb = $image->size(400, 300, $options); $large = $image->size(1200, 0, $options); echo "<div class='col-4'>"; echo "<span class='image fit'>"; echo "<a href='$large->url'>"; echo "<img src='$thumb->url' alt='$image->tags'>"; echo "</a>"; echo "</span>"; echo "</div>"; } } and i inputted your code with my code $tag = $input->get->text('tag'); $found = $pages->find("images.tags~=$tag"); foreach($found as $image){ $options = array('quality' => 70, 'upscaling' => true, 'cropping' => 'center', 'sharpening' => 'medium'); #$thumb = $image->size(400, 300, $options); #$large = $image->size(1200, 0, $options); echo "<div class='col-4'>"; echo "<span class='image fit'>"; echo "<a href='$large->url'>"; echo "<img src='$thumb->url' alt='$image->tags'>"; echo "</a>"; echo "</span>"; echo "</div>"; } and it doesnt seems to work, i commented out #thumb and #large because i was getting but it is not working? my idea is that maybe the find function is not working properly did i forgot to mentioned that i have all images on different pages by that i mean i have Home (main page) - subpage - images - subpage - images so i need to search all subpages that has the specific tag
  4. Hello so i have very specific kind of problem I can find all images on all subpages and put them in array the problem lays when i need to on click of a link show only images that has one or more clicked tags, is that even possible? Hide and show images on click with php I was thinking maybe add the tags to img somehow and then hide and show them with javascript but i dont know how to do that or is there a easier way?
  5. omg thank you so much i was so stupid 😄 i changed it to this and it work foreach ($page->produkt_repeat_field as $building) { foreach ($building->r_galeria_image as $obrazok){ $thumbnail = $obrazok->size(450, 250); echo"<article>"; echo "<a href='{$obrazok->url}' class='fresco' data-fresco-caption='{$obrazok->description}' data-fresco-group-options='preload: [1,2], effects: {spinner: {show:150, hide:150 } }' data-fresco-group='kolace'><img src='$thumbnail->url' alt='obrazok'></a>"; echo"</article>"; } } i totally forgot i was looping throught repeat fields and not throught gallery, thank you sorry for my mistake
  6. so i have some experience with repeat fields i used it past my websited but on this new website it doesnt seem to work what i did is i made repeat field "produkt_repeat_field" and inside i have put "r_galeria_image" so logically when i ahve something like this foreach ($page->produkt_repeat_field as $building) { $thumbnail = $building->r_galeria_image->size(450, 250); echo"<article>"; echo "<a href='{$building->r_galeria_image}' class='fresco' data-fresco-caption='{$building->r_galeria_image->description}' data-fresco-group-options='preload: [1,2], effects: {spinner: {show:150, hide:150 } }' data-fresco-group='kolace'><img src='$thumbnail->url' alt='obrazok'></a>"; echo"</article>"; } it should work right ? but i get error Error: Exception: Method Pageimages::size does not exist or is not callable in this context (in /www/pw/weby/wire/core/Wire.php line 529) and yes i checked i uploaded 4 images i am so confused about this
  7. ok sorry for confusing title but what i am tryin to do that my page will fetch images from the deepest layer of its children i will show it so as you can see i have Produkty and the n have 3 children which 2 of then includes final procuts and first children has anotehr 2 categories and the nit has final children so right now i have it like this if ($page->hasChildren()) { foreach ($page->children as $child) { $image = $child->r_produkty_image->first(); //some code } and it only fetches thumbnails of products only 1 child deep. so for example for Terasové prestrešenia to be shown in products i need to upload pictures to that page but i would like that Terasové prestrešenia would fetch image from S dizajnom strechy so spádom and that would fetch image from Lapure which is final product and should and will include images. so that those categories wont include unesecary field and images sorry for complexity and bad english i hope you get me
  8. oh yeah yo u are right i tried finding difficult solution to a simple problem sorry ill mark this as solved
  9. so i have very dirty setup, i want to use one template for all pages except homepage so far i have it like this if ($page->title == 'Kontakt') { echo "iframe of map goes here"; } elseif ($pages->count("parent.title=galeria1 kontakt realizacia ")) { // do some code please } elseif () and so one like 3-4 conditions, and i tried what is already in there using the parent.title function but i dont think i understand it. it doesnt show the code when the page i already am doesnt have any more children. what i am trying to do is to have execute code when you have children execute code when you dont have any children (this is so called individiual product page for me) execute some code for pages like contact gallery individual stuff, this could be done using title or ID right now i have it like $page->id != 1028 xor $page->id != 1077 xor $page->id != 1084 is this somehow possible ? one template, all have same field, i am even using repeaters which is totally new for me sorry for my faulty english i am not a native speaker
  10. uhhh sorry again but how do i close/delete this thread if solved ?
  11. Sorry for this amaterus mistake , you were right i totally forgot about those JS paths, i changed those css paths by adding "<?=$config->urls->templates;?>" before the path and css worked but i forgot to add it to those scripts too, sorry for making this thread i'll close it now hello by php changes i just splitted header, footer, body and sub-page to it's own .php files and including footer.php and header.php in home.php and sub-page.php, i also tried adding image fields but so far without a succsess. thanks for fast replies
  12. so i just downloaded this template and i uploaded it to my server made some .php changes so it would work and stuff but all the css-transitions or css-animations don't work. they just stop if you checked out the template all those buttons are smooth and really nice, bit when you check out my site all those animations are gone, why is that? is there some option i have to toggle? or is it normal? how do i fix it ?
×
×
  • Create New...