Jump to content

Sanyaissues

Members
  • Posts

    125
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Sanyaissues

  1. @Edward Ver you can use the contains operator for that. 1. First, set your field to use Pipe as delimiter (edit field > input > tag delimeter). With that, if our Page1 has 3 tags: logo vector illustration, they will be stored like this: logo|vector|illustration The pipe separator will be very useful because of this https://processwire.com/docs/selectors/#or-selectors1 2. Now lets find pages containing any of the tags of the page: //This will find pages containing any of this tags logo|vector|illustration (including the current page) $p = $pages->find("tags*={$page->tags}"); echo $p->each('{title} <br>'); 3. Let's remove the current page from the results: // Option 1: find all the pages and remove the current page. $p = $pages->find("tags*={$page->tags}")->remove($page); echo $p->each('{title} <br>'); //Option 2: find pages where the page ID isn't the same as the current page $p = $pages->find("id!={$page->id}, tags*={$page->tags}"); echo $p->each('{title} <br>');
  2. To get the things done you need to play around with the logic until you hit the pot (usually the logic we write and the logic we think we write are different). To find the issue, let's poke your logic a little: // Find all pages with the template work_details and where the field tags is exactly the same as this page tags field $items = $pages->find("template=work_details, tags=$page->tags"); When viewing Page1 that will be translated to: //Pages with template work_details and field tags equal to branding/identity $items = $pages->find("template=work_details, tags=branding/identity"); To discover why you aren't getting the results you are expecting, try something simple first: // You can copy and paste each of these examples into your code // First, let's verify if all the pages with a specific tag are being fetched. // Print the title of all pages with a tags field containing "branding/identity" $items = $pages->find("tags=branding/identity"); echo $items->each('{title}'); // Now, let's do the same dynamically and also print the value of the tags to understand what $page->tags contains. // Print the title of all pages with a tags field equal to this page's tags field and print the value of tags $items = $pages->find("tags=$page->tags"); echo $items->each('{title} <br>'); echo "Tags value: " . $page->tags; // Also, note we can search for tags fields that contain a string using %= instead of = // Print the title of all pages containing the string from the page's tags field $items = $pages->find("tags%=$page->tags"); echo $items->each('{title} <br>'); echo "Tags value: " . $page->tags; As as side note, debugging will be way easier if you install TracyDebugger.
  3. $items = $pages->find("template=work_details, tags=$page->tags"); 'tags' is a textfield, but you're passing the entire page object (tags=$page"). You need to pass the tags textfield value instead. I'm assuming that your textfield contains only one tag, e.g: new and not multiple tags like: new, cool, favorites If you want to learn more about selectors, try this: https://processwire.com/docs/selectors/#api-variables-in-selectors Also, you are missing some things in the repeater foreach <?php $items = $pages->find("template=work_details, tags='{$page->tags}'"); ?> <ul> <?php foreach($items as $item): ?> <?php foreach($item->work_hero_repeater as $work_hero_repeaters): //here! ?> <li> <?= $work_hero_repeaters->work_hero_image->getCrop('hero')->url ?> <a href="<?= $work_hero_repeaters->pager_link->url ?>"></a> </li> <?php endforeach; //and here! ?> <?php endforeach; ?> </ul>
  4. being 1033 the page with the children you want to get: //Given than child only returns a single page, you can use sort,to for example get the newest child of 1033. $pages->get(1033)->child("sort=-created, include=hidden");
  5. pages(1040)->title; $pages->get(1040)->title; $pages->findOne("id=1040, include=hidden")->title(); Here's an example dumping the title property and the status of my Demo, hidden page.
  6. T_CONSTANT_ENCAPSED_STRING happens because there's a string that is not properly enclosed within quotes. In your case I'll start by disabling the Media Lister module. If the error goes away, check for any unusual characters in your media files names or tags, that might be causing the problem when the module processes your files (just guessing here). Also check the code in the ProcessMediaLister.module file around line 486 for any unclosed strings or issues with quotes (or share with us more info of the error)
  7. Yes we can @SIERRA. Introducing: Fluency. The complete translation enhancement suite for ProcessWire.
  8. @protro are you using any hook to generate images? I'm guessing here, but the behavior and logs suggest me that the slow issue is because your machine processing the images generation, probably not related with profields at all. Maybe similar? For the cache, try this https://processwire.com/modules/process-cache-control/
  9. But the real question @bernhard is: Did the spambot find an answer to its 404 error, or is it doomed to wander the digital void, searching for a purpose it can’t quite find? I like to live in a world where bots can improve themselves thanks to human forum answers.
  10. Webmin + Virtualmin: for web hosting management (I was a plesk user until I found webmin). Analytics: GoatCounter: No tracking analytics for simple (and usually personal) websites. Plausible: Self hosted non Google analytics.
  11. @BarryP In ProcessWire, when a page is loaded, it calls a template file located in the `/site/templates/` directory. You need to find the template with that image (maybe `site/templates/home.php`, `hero-banner`, `section-intro`...) and check why there's no value for the `src` (aka: the reason why your image is broken).
  12. @7Studio What about an Amazon lightsail linux instance? Maybe you can try with a 2GB virtual server (they give you 3 months for free). Ubuntu or Amazon Linux instances with Webmin on top and auto backups on a S3 bucket will be cheap and pro.
  13. @François Lacruche you can read more about permissions in the post I linked before and security here: https://processwire.com/docs/security/ By doing `chmod -R og+rw site/assets` you added read and write permissions to `others` and `group`. The recommendation is: 0755 for directories: 7: Owner (full control: read, write, execute) 5: Group (read and execute) 5: Others (read and execute) 0644 for static files: 7: Owner: Read and write permissions (rw-) 4: Group: Read permissions (r--) 4: Others: Read permissions (r--) So just to be sure, you can execute: `chmod 755 site/assets/` (permissions for directory) and then `find site/assets/ -type f -exec chmod 644 {} \;` (permissions for files)
  14. The main benefit of this thread is that I finally have a space to post in PW forums. I have this internal desire of being super active here, but as a forever-noob developer I can't participate in others people's topics. So, this post suits me hahaha. I have a secret: The infinite site hosting scheme. The only word in marketing that's more 'scheme' than 'scheme' is infinite. And when they combine infinite and secret, you can know you've officially landed in the Promised Land.
  15. I tried a few more tests, and in my case, deleteAll() works every single time. But it seems like is a good idea to enable trackChange when modifying images. There are a few other examples in the forum, but they seem based on Soma's post. Hopefully someone else can explain us the why.
  16. Seems like after updating the DDEV instance some extensions were removed from the container, after reinstalling intelephense the methods are working. Thanks!
  17. Maybe try: $this->related_tutor->template->fields->skills->getLabel($user->language); Edit: looks like $user->language is the default, but give it a try
  18. Check this post from Ryan If test_image_field contains multiple images your code will work. As you can see in this test we deleted 3 items from the `image` field. And here's an example to delete the first image ("all images" in the case of a single image field) If the error persists please install Tracy, run this in the console and share me the ouput: $p = pages(9999); $p->of(false); d($p->test_image_field); $p->test_image_field->deleteAll(); d($p->test_image_field); $p->save('test_image_field');
  19. Thanks @bernhard! rmf- suggestions are working for me. But I cannot find a way to see methods as createPage, deleteField as you do in your video. If you can point me in the right direction I would appreciate it.
  20. If you want to embed the PDF avoiding the browser's native PDF viewer you can use a third party service like smallPDF (easy way), or you can parse your own PDF and use your own viewer with something like PDF.js. You can even provide the document as Base64 instead of providing a PDF file (ninja way).
  21. Try this @Edward Ver: <ul class="menu-main md:text-[16px] text-[18px]"> <!-- Loop through each child of the homepage --> <?php foreach($children as $child): ?> <!-- Check if the child has sub-children --> <?php if($child->hasChildren()): ?> <li class="menu-item-has-children"> <a href="<?= $child->url ?>" class="menu_link "> <?= $child->title ?> <i class="text-lg icon-chevron-down align-[-2px]"></i> </a> <div class="w-full border-t-2 rounded-md md:w-9/12 sub-menu mega-menu border-rose-600 max-w-[1280px] "> <div class="list-item"> <ul class="grid grid-cols-1 gap-1 lg:grid-cols-3 megamen--seclevel lg:grid-flow-col md:grid-rows-1 lg:grid-rows-11"> <!-- Loop through each sub-child --> <?php foreach($child->children() as $subchild): ?> <li class="w-full"> <a href="<?= $subchild->url ?>"><?= $subchild->title ?></a> </li> <?php endforeach; ?> </ul> </div> </div> </li> <!-- If the child has no sub-children --> <?php else: ?> <li><a href="<?= $child->url ?>"><?= $child->title ?></a></li> <?php endif; ?> <?php endforeach ?> </ul> Or this alternative where the <li> for subchildren and non-subchildren is the same, but we apply different classes based on $child->hasChildren() output. <?php // Get the homepage $home = pages()->get('/'); // Get the children of the homepage $children = $home->children(); ?> <ul class="menu-main md:text-[16px] text-[18px]"> <!-- Loop through each child of the homepage --> <?php foreach($children as $child): ?> <!-- Apply 'menu-item-has-children' class if the child has sub-children --> <li class="<?= $child->hasChildren() ? 'menu-item-has-children' : '' ?>"> <a href="<?= $child->url ?>" class="menu_link"> <?= $child->title ?> <!-- Show dropdown icon if the child has sub-children --> <?php if($child->hasChildren()): ?> <i class="text-lg icon-chevron-down align-[-2px]"></i> <?php endif; ?> </a> <!-- Display sub-menu if the child has sub-children --> <?php if($child->hasChildren()): ?> <div class="w-full border-t-2 rounded-md md:w-9/12 sub-menu mega-menu border-rose-600 max-w-[1280px]"> <div class="list-item"> <ul class="grid grid-cols-1 gap-1 lg:grid-cols-3 megamen--seclevel lg:grid-flow-col md:grid-rows-1 lg:grid-rows-11"> <!-- Loop through each sub-child --> <?php foreach($child->children() as $subchild): ?> <li class="w-full"> <a href="<?= $subchild->url ?>"><?= $subchild->title ?></a> </li> <?php endforeach; ?> </ul> </div> </div> <?php endif; ?> </li> <?php endforeach; ?> </ul>
  22. Hi @Edward Ver don't worry, we are here to help you navigate PW! Here's an example for the menu you asked for: <?php // Get the homepage $home = pages()->get('/'); // Get the children of the homepage $children = $home->children(); ?> <nav class="menu"> <ul> <!-- Loop through each child of the homepage --> <?php foreach($children as $child): ?> <li> <a href="<?= $child->url ?>" class="menu_link"><?= $child->title ?></a> <!-- Check if the child has sub-children --> <?php if($child->hasChildren()): ?> <ul class="sub-menu mega-menu"> <!-- Loop through each sub-child --> <?php foreach($child->children() as $subchild): ?> <li class="menu-item-has-children"> <a href="<?= $subchild->url ?>"><?= $subchild->title ?></a> </li> <?php endforeach; ?> </ul> <?php endif; ?> </li> <?php endforeach; ?> </ul> </nav> The code wasn't tested but it should work.
  23. Hi @bernhard. I'm about to try rockmigrations, I already saw your videos (amazing job, thank you!), poke the docs and read a few posts on this thread. But there's something I'm wondering: Let's say we have a clean PW installation and we want to create a page (dar) with the template (doo) and two fields (foo & bar). What "workflow" will you follow to deploy them? My first guess: 1. On migrate.php we create the page, template and fields: 2. We create /site/classes/DooPage.php to define the settings for the doo template: - Is that approach Ok? Any tips? - After the page, template and fields were created, it's Ok to leave the "creation" instructions on migrate.php? Any risk of conflict with the instructions on DooPage (in my example I defined different titles for the foo and bar fields)? - How can I see the RM methods using the vscode snippets? Thanks.
  24. Cool, add any updates here. But it looks like a permission issue with your /site/assets folder. Try: chmod -R og+rw /site/assets Or maybe you can restore the files and folders manually by going to drive.google.com and download the folder contents. Don't know how the sync works, but maybe your local files permissions are "screwed" but the files in the cloud version are Ok. Here's a related discussion you can read.
  25. Hi @François Lacruche, I assume you are running a website on your computer and when you synced the folder to Google Drive, the permissions of the folders/files got "corrupted". - Where are you seeing the "destinationPath is not writable" error? Please share a capture. - Is the site accessible? - Can you access the admin? Some possible solutions (just guessing here): - Try to set the permissions for the folders/files https://processwire.com/docs/security/file-permissions/#how-to-change-permissions-of-existing-files - What if you do a new Processwire installation in a new folder and after the installation is done, you copy the files inside the "corrupted: /site/ folder to the new installation?
×
×
  • Create New...