Jump to content

combicart

Members
  • Posts

    70
  • Joined

  • Last visited

Recent Profile Visitors

2,147 profile views

combicart's Achievements

Full Member

Full Member (4/6)

20

Reputation

  1. @Robin S That's really great! Will use the combined setup with getPaginationString() and MarkupPagerNav to achieve the pagination markup. Thanks, for pointing me in the right direction!
  2. Hey, i'm currently building a website with a news section. On the overview page I would like to add a pagination so that users can easily switch from page to page. I already included the MarkupPagerNav setup. However I would like to adjust the output of the module and I'm not really sure how to adjust it to my needs. I would e.g. like to output the current page and the total number of pages. See example below of what I would like to achieve: Could someone point me in the right direction on how to output the correct variables? Thanks!
  3. Hi there, I would like to start the navigation on the 2nd level / depth instead of the 1st. I've tried to set this up with the `$rootPage` variable, bit I can't seem to find the correct flow for what i'm trying to achieve. Ideally I want to use the following setup: - Home -- Location A --- Page 1 --- Page 2 -- Location B --- Page 3 --- Page 4 When you're on the Homepage the menu should show: Home - Location A - Location B When you're on the Location A page, the menu shows: Home (which is the Location A page) - Page 1 - Page 2 Is there a way to achieve this with the MarkupSimpleNavigation module? Or could somebody point me in the right direct to implement this menu? Thanks!
  4. Thanks for pointing me in the right direction. I've add a hook to the ready.php file. If someone is interested, below i've added a snippet of what i'm using: wire()->addHookAfter('Pages::saveReady', function(HookEvent $event) { $page = $event->arguments(0); foreach ($page->body_extended as $item) { // $body_extended is the name of the matrix field if ($item->type == 'text') { // Looking for a 'text' matrix field $seo_description = substr(strip_tags($item->body), 0, 255); // Find the body text and strip/trim the html tags break; } } $page->seo_description = $seo_description; // Save the body inside the seo_description field on the page });
  5. In my current setup I've added a matrix field called 'body_extended'. Inside this field one of the matrix types is a 'text' block. Inside this block I have two fields: 'title' and 'body'. The body field is a CKEditor text area field. I would like to copy the content of the 'body' field that is inside the first 'text' block that is available on the page inside a different field (called 'seo_description') on the same page (just a regular field, not a matrix field) however I'm struggling to find the best approach. I've started looking into hooks but I'm not sure if and which hook is suitable for this situation. Has somebody faced a similar situation before or could someone point me in the right direction? I've attached a screenshot of what I'm trying to accomplish. Thanks!
  6. Hi @dragan, thanks! I've just implemented the hook and it's working perfectly! Thanks for pointing me in the right direction!
  7. Is it possible to show additional markup for a specific menu item? I would like to show the number of subpages (with it's own markup) for one specific main menu item. The page is a regular page with the same template as other pages in the menu. Would this be possible?
  8. Thanks @Autofahrn, adding it to $config worked perfectly!
  9. I'm currently building a website where I inline some SVG icons directly into the template. I'm using https://github.com/oscarotero/inline-svg for inlining the icons. I've added the code below to my _init.php file to set where all the icons are stored: $icons = Collection::fromPath('path/to/svg/files'); Inlining an actual SVG icon can be done with the code below. In the example below we are adding an SVG icon with the name 'edit': echo $icons->get('edit'); So far everything is working as it should. For bigger parts of the template i'm using delayed output and i'm passing the 'icons' variable into the separate template files, like below: $content = wireRenderFile('partials/homeFacilities', ['icons' => $icons]); This outputs the icons inside the partials. For setting up details of a page i'm using the ProFields Repeater Matrix module and this is where i'm getting an error. I have to pass the 'icons' variable into the Repeater Matrix template files, however I can't seem to set it correctly so that the template files have access to this variable. The Repeater Matrix fields is setup like below: foreach ($value as $item) { echo $item->render(); } Is there a way to pass the 'icons' variable into the Repeater Matrix template files? Or would it e.g. be beter to make this variable accessible globally?
  10. Ah, totally overlooked this option. Setting this to false solved the problem! Thanks!
  11. I'm currently using the RSS Feed Loader module (https://modules.processwire.com/modules/rss-feed-loader/) to import an RSS feed. In the feed there is an 'description' field that has html markup inside. By default the html markup is stripped out by the module Therefore i've used the option below to render the description including markup: $rss->stripTags = false; After adding this option, the values in the database are still escaped, e.g. like: <h3 class="deprecated-h3">Description</h3> <p>Description</p>  Would it be possible to save the description field directly into the database (including it's HTML markup)?
  12. I would like to import a description field including it's HTML markup. In the RSS feed the markup is included, however by default the markup is stripped by the RSS feed module. Therefore i've used the option below to render the description including markup: $rss->stripTags = false; After adding this option, the values in the database are still escaped, e.g. like: <h3 class="deprecated-h3">Description</h3> <p>Description</p> Would it be possible to save the description field directly into the database (including it's HTML markup)?
  13. I'm currently working on a website where I would like to fetch data from an RSS feed and save them as actual pages inside ProcessWire. Ideally ProcessWire is an exact copy of the RSS feed. When a new page is added to the RSS feed, the new page would also be added in ProcessWire. Or when a page got removed from the RSS feed, the page should also be delete from within ProcessWire. I'm using the following setup: 1. Fetch the RSS feed with $rss = $modules->get('MarkupLoadRSS'); $rss->load('http://www.domain.com/rss'); 2. Compage the RSS feed with the pages that are currently save in Processwire foreach ($rss as $item) { ... } 3. If page is in RSS feed, but not in ProcessWire, save page 4. If page is in RSS feed and in ProcessWire, update values with data from the RSS feed 5. If page is not in RSS feed, but in ProcessWire, delete page To get all the pages from the RSS feed, check if it exists and create the page from the API if it doesn't exist, i'm using the code below: <?php include './index.php'; // bootstrap PW $rss = $modules->get('MarkupLoadRSS'); $rss->load('http://www.domain.com/rss'); foreach ($rss as $item) { $p = $pages->get("job_id=$item->id"); // get the ide of the job if (!$p->id) { $p = new Page(); // create new page object $p->template = 'job-offer'; // set template $p->parent = wire('pages')->get('/vacatures/'); // set the parent $p->name = slugify($item->title); // give it a name used in the url for the page $p->title = $item->title; // set page title (not neccessary but recommended) // added by Ryan: save page in preparation for adding files (#1) $p->save(); // populate fields $p->job_id = $item->id; $p->save(); // testing echo 'id: ' . $p->id . '<br/>'; echo 'path: ' . $p->path; } } So far everything works and the pages got created ? However I'm having trouble with the logic for points 4 and 5. - When a page is in the RSS feed and is already add to ProcessWire. Is there a way to find a page and update it's content through the API? - When a page is not in the RSS feed anymore. Is there a way to delete all pages that are not in the RSS feed? Thanks!
  14. Thanks @FrancisChung and @adrian! Will check out both SimpleXML and the CSV parser to see which approach fits best for the XML feed. About the 1300 pages, yeah I've already checked about ways to speed up the import process. Unfortunately they only provide 1 large XML feed which contains both the old and updated pages. They provide a date and UUID field inside the XML feed which I could use to check if there is something updated or not. Totally agree with you that ideally only the changes are being processed instead of the complete file again and again.
×
×
  • Create New...