Edward Ver
Members-
Posts
22 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Edward Ver's Achievements
Jr. Member (3/6)
11
Reputation
-
Using different javascript for multilanguage website
Edward Ver replied to Edward Ver's topic in General Support
That works! Thank you so much! <?php if($user->language->name == "en-gb"): ?> <script src="<?php echo $config->urls->templates; ?>assets/scripts/cookieconsent-init-en.js" async></script> <?php else: ?> <script src="<?php echo $config->urls->templates; ?>assets/scripts/cookieconsent-init-no.js" async></script> <?php endif; ?> -
How to load a different js for another language? I'm new to PW, and my first time developing a multi language website in PW too. I came across a problem where I have to load a different js for english for example. Norwegian (default lang): <script src="<?php echo $config->urls->templates; ?>assets/scripts/cookieconsent-init-no.js" defer></script> How to load it if the url is mydomain.com/en. Thank you in advance.
-
OK, did it. I just added this: <?php if( $child->id == $pages->get("/news")->id ): ?> <li <?php if ($child->id == $page->rootParent->id): ?> class="current"<?php endif; ?>><a href="<?= $child->url ?>"><?= $child->title ?></a></li> <?php else: ?>
-
@Sanyaissues How not to show the Submenu of a "Blog" parent menu. I tried to search the forum and found no answers. Thanks.
-
Thank you Sanyaissues. It's working perfectly now. Again, thank you for your time. Highly appreciated.
-
This is the one that works for me: <?php if ($page->tags): ?> <?php $items = $pages->find("template=work_details,id!=$page,tags='{$page->tags}'"); ?> <?php foreach($items as $item): ?> <div class="w-full py-16 bg-slate-50"> <div class="max-w-[89.5rem] md:mx-auto"> <h3 class="w-full !mt-0 mb-6 text-2xl text-center ">Related Projects</h3> <div class="flex flex-row flex-wrap items-center justify-center gap-4 lg:flex-col "> <?php foreach($item->work_hero_repeater as $work_hero_repeaters): ?> <div class="relative group"> <div class="overflow-hidden"> <img class="lozad w-full rounded-sm mt-0 lozad group-hover:scale-105 transform-gpu group-hover:saturate-150 transition-all duration-[600ms] " data-src="<?= $work_hero_repeaters->work_hero_image->getCrop('gridsquare')->url ?>" alt="<?= $work_hero_repeaters->work_hero_image->description ?>" > </div> <h5 class="pt-5 text-xl font-gloock"><?= $work_hero_repeaters->work_client ?></h5> <p class="flex-1 px-5 text-left font-raleway md:px-0"><?= $work_hero_repeaters->work_hero_subheading ?></p> <p class="top-0 left-0 hidden w-full h-full"><?= $work_hero_repeaters->tags ?></p> <a class="absolute top-0 left-0 w-full h-full group" href="<?= $work_hero_repeaters->pager_link->url ?>"></a> </div> <?php endforeach; ?> </div> </div> </div> <?php endforeach; ?> <?php else: ?> <?php endif; ?> I hope someone will find it useful. BTW Sanyaissues , How do you change it to accept more than 1 tag. If I use 2 tags e.g: Illustration , Logo, it does not work.
-
Well, it was silly of me. The Field "tags" was inside a repeater of the page template. I move it to out of the repeater, and it works now. Hey, don't judge me, I'm still learning :P. Thank you for your precious time Sanyaissues
-
Just one more issue, Yes, each tag field only has one tag. Even though each page has e.g: Page1 Page2 They all show on a page. I only want pages with the same tag visible on a page. Any ideas? or I'm doing something wrong. Thanks in advance
-
Thank you very much Sanyaissues. That works like a charm. Still learning PW, and lovin it so far.
-
Hi Guys, I want to display pages with the same tag. But nothing is showing. I'm new to this and I'm no PHP DEV. Any help to guide me to the right approach will be a great help. Project details page (work_details.php template) - work_hero_repeater (repeater) - tags (text field) - client_name (Text field) - hero_image (Image Field) <?php $items = $pages->find("template=work_details, tags=$page") ?> <ul> <?php foreach($items as $item): ?> <?php foreach($item->work_hero_repeater as $work_hero_repeaters) ?> <li><?= $work_hero_repeaters->work_hero_image->getCrop('hero')->url ?> <a href="<?= $work_hero_repeaters->pager_link->url ?>"></a> </li> <?php endforeach; ?> </ul>
-
Got the idea and it works. Thank you very much!
-
Accessing fields in Repeater outside of page?
Edward Ver replied to V7dev's topic in General Support
Opp wrong post -
Hi All, I'm still learning PW, and loving it. But, I'm no PHP coder. My Problem is how to output fields from another page inside a repeater. <?php $showcase = $pages->find("template=work_details") ?> <?php foreach($showcase as $showcases): ?> <div> <p class="pb-2 text-left"><?= $showcases->work_hero_subheading ?></p> // This is inside a repeater called "work_hero_repeater" </div> <?php endforeach; ?> But there is no output. Thank you for any help.
-
I tried your suggestion but I get an error. "Snapsicles… Fatal Error: Uncaught Error: Call to undefined function wireCount()" <?php $blogger = $pages->find("template=blog_entry,featured_post=1"); // my template ?> <?php if (wireCount($blogger)) : // Check if there are any bloggers ?> <?php foreach ($blogger as $bloggers) : ?> <?php if (wireCount($bloggers->blog_entries)) : // Check if there are any blog entries ?> <?php foreach ($bloggers->blog_entries as $blog_entry) : // my repeater field ?> <div> <a href="<?= $blog_entry->url ?>"> <h1 class="text-xl"><?= htmlspecialchars($blog_entry->title) ?></h1> </a> <a href="<?= $blog_entry->url ?>"> <img src="<?= $blog_entry->blog_main_image->getCrop('blogsmall')->url ?>" alt="<?= $blog_entry->blog_main_image->description ?>"> </a> <?= $sanitizer->truncate($blog_entry->blog_text, 100, ['type' => 'sentence', 'keepFormatTags' => false]) ?> <p class="test_to_show_value_of_featured_filed"><?= $blog_entry->featured_post ?></p> </div> <?php endforeach; // End of blog_entries loop ?> <?php endif; // End of blog_entries check ?> <?php endforeach; // End of bloggers loop ?> <?php endif; // End of bloggers check ?>
-
So silly. I placed the $featured_field inside the repeater. Solved