Search the Community
Showing results for tags 'xml'.
-
Docs & Download: rockettpw/seo/markup-sitemap Modules Directory: MarkupSitemap Composer: rockett/sitemap ⚠️ NEW MAINTAINER NEEDED: Sitemap is in need of developer to take over the project. There are a few minor issues with it, but for the most part, most scenarios, it works, and it works well. However, I'm unable to commit to further development, and would appreciate it if someone could take it over. If you're interested, please send me a private message and we can take it from there. MarkupSitemap is essentially an upgrade to MarkupSitemapXML by Pete. It adds multi-language support using the built-in LanguageSupportPageNames. Where multi-language pages are available, they are added to the sitemap by means of an alternate link in that page's <url>. Support for listing images in the sitemap on a page-by-page basis and using a sitemap stylesheet are also added. Example when using the built-in multi-language profile: <url> <loc>http://domain.local/about/</loc> <lastmod>2017-08-27T16:16:32+02:00</lastmod> <xhtml:link rel="alternate" hreflang="en" href="http://domain.local/en/about/"/> <xhtml:link rel="alternate" hreflang="de" href="http://domain.local/de/uber/"/> <xhtml:link rel="alternate" hreflang="fi" href="http://domain.local/fi/tietoja/"/> </url> It also uses a locally maintained fork of a sitemap package by Matthew Davies that assists in automating the process. The doesn't use the same sitemap_ignore field available in MarkupSitemapXML. Rather, it renders sitemap options fields in a Page's Settings tab. One of the fields is for excluding a Page from the sitemap, and another is for excluding its children. You can assign which templates get these config fields in the module's configuration (much like you would with MarkupSEO). Note that the two exclusion options are mutually exclusive at this point as there may be cases where you don't want to show a parent page, but only its children. Whilst unorthodox, I'm leaving the flexibility there. (The home page cannot be excluded from the sitemap, so the applicable exclusion fields won't be available there.) As of December 2017, you can also exclude templates from sitemap access altogether, whilst retaining their settings if previously configured. Sitemap also allows you to include images for each page at the template level, and you can disable image output at the page level. The module allows you to set the priority on a per-page basis (it's optional and will not be included if not set). Lastly, a stylesheet option has also been added. You can use the default one (enabled by default), or set your own. Note that if the module is uninstalled, any saved data on a per-page basis is removed. The same thing happens for a specific page when it is deleted after having been trashed.
- 189 replies
-
- 18
-
My aim is to output a very basic xml document which should be styled with a few css-styles. <?xml version = "1.0"?> <contact-info> <name>Donal Duck</name> <company>Superducks</company> <phone>(011) 123-4567</phone> </contact-info> How do I implement it with processwire?
-
Hi, just wanted to share something I came across while working on an import module for XML data from a web service. The XML I got was not huge, but still, loading around 3.5 MB of XML with 250+ large child nodes into memory at once with simplexml_load_file() and then looping over it had significant impact on performance. I searched for a solution and found this great article about how to parse large XML files. It basically explains how to utilize the native XMLReader class together with SimpleXMLElement to handle such situations in a memory efficient way. After implementing it I got a significant improval on perceived performance. No comparison in numbers to share here as I'm a bit short on time.
-
SYNOPSIS A little guide to generating an sitemap.xml using (I believe) a script Ryan originally wrote with the addition of being able to optionally exclude child pages from being output in the sitemap.xml file. I was looking back on a small project today where I was using a php script to generate an xml file, I believe the original was written by Ryan. Anyway, I needed a quick fix for the script to allow me to optionally exclude children of pages from being included in the sitemap.xml output. OVERVIEW A good example of this is a site where if you visit /minutes/ a page displays a list of board meetings which includes a title, date, description and link to download the .pdf file. I have a template called minutes and a template called minutes-document. The first page, minutes, when loaded via /minutes/ simply grabs all of its child pages and outputs the name, description and actual path of an uploaded .pdf file for a visitor to download. In my back-end I have the template MINUTES and MINUTES-DOCUMENT. Thus: So, basically, their employee can login, hover over minutes, click new, then create a new (child) record and name it the date of the meeting e.g. June 3rd, 2016 : --------------------------- OPTIONALLY EXCLUDING CHILDREN - SETUP Outputting the sitemap.xml and optionally excluding children that belong to a template. The setup of the original script is as follows: 1. Save the file to the templates folder as sitemap.xml.php 2. Create a template called sitemap-xml and use the sitemap.xml.php file. 3. Create a page called sitemap.xml using the sitemap-xml template Now, with that done you will need to make only a couple of slight modifications that will allow the script to exclude children of a template from output to the sitemap.xml 1. Create a new checkbox field and name it: sitemap_exclude_children 2. Add the field to a template that you want to control whether the children are included/excluded from the sitemap. In my example I added it to my "minutes" template. 3. Next, go to a page that uses a template with the field you added above. In my case, "MINUTES" 4. Enable the checkbox to exclude children, leave it unchecked to include children. For example, in my MINUTES page I enabled the checkbox and now when /sitemap.xml is loaded the children for the MINUTES do not appear in the file. A SIMPLE CONDITIONAL TO CHECK THE "sitemap_exclude_children" VALUE This was a pretty easy modification to an existing script, adding only one line. I just figure there may be others out there using this script with the same needs. I simply inserted the if condition as the first line in the function: function renderSitemapChildren(Page $page) { if($page->sitemap_exclude_children) return ""; ... ... ... THE FULL SCRIPT WITH MODIFICATION <?php /** * ProcessWire Template to power a sitemap.xml * * 1. Copy this file to /site/templates/sitemap-xml.php * 2. Add the new template from the admin. * Under the "URLs" section, set it to NOT use trailing slashes. * 3. Create a new page at the root level, use your sitemap-xml template * and name the page "sitemap.xml". * * Note: hidden pages (and their children) are excluded from the sitemap. * If you have hidden pages that you want to be included, you can do so * by specifying the ID or path to them in an array sent to the * renderSiteMapXML() method at the bottom of this file. For instance: * * echo renderSiteMapXML(array('/hidden/page/', '/another/hidden/page/')); * * patch to prevent pages from including children in the sitemap when a field is checked / johnwarrenllc.com * 1. create a checkbox field named sitemap_exclude_children * 2. add the field to the parent template(s) you plan to use * 3. when a new page is create with this template, checking the field will prevent its children from being included in the sitemap.xml output */ function renderSitemapPage(Page $page) { return "\n<url>" . "\n\t<loc>" . $page->httpUrl . "</loc>" . "\n\t<lastmod>" . date("Y-m-d", $page->modified) . "</lastmod>" . "\n</url>"; } function renderSitemapChildren(Page $page) { if($page->sitemap_exclude_children) return ""; /* Aded to exclude CHILDREN if field is checked */ $out = ''; $newParents = new PageArray(); $children = $page->children; foreach($children as $child) { $out .= renderSitemapPage($child); if($child->numChildren) $newParents->add($child); else wire('pages')->uncache($child); } foreach($newParents as $newParent) { $out .= renderSitemapChildren($newParent); wire('pages')->uncache($newParent); } return $out; } function renderSitemapXML(array $paths = array()) { $out = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'; array_unshift($paths, '/'); // prepend homepage foreach($paths as $path) { $page = wire('pages')->get($path); if(!$page->id) continue; $out .= renderSitemapPage($page); if($page->numChildren) { $out .= renderSitemapChildren($page); } } $out .= "\n</urlset>"; return $out; } header("Content-Type: text/xml"); echo renderSitemapXML(); // Example: echo renderSitemapXML(array('/hidden/page/')); In conclusion, I have used a couple different processwire sitemap generating modules. But for my needs, the above script is fast and easy to setup/modify. - Thanks
-
Hello, for an Project i need help for an Script. There is an XML File with all the Objects Data and Images for every object. This is the Data Structure http://prntscr.com/hvfo31 One XML file and Pictures. So every Time the new Data is Uploadet via ImmoTool there have to be maybe an batch or something or an button in the Sitebackend to check the new files. If the Status is NEW then create an Object if the Status is CHANGE then make some changes If the Status is Delete then remove the Object in other Parent There are Basic infos in XML like Description Rooms etc. Also the latitude and attitude for the maps. After succsessful changes the Folder schould be empty for the next upload. I need only help to create and handle the sites with some data (PW API ). The output I will generate by myself. I have some basic php code Need somebody to fix it ready for me in PW. Tnx
-
I was looking for a module that allows the execution of long-running tasks (working with tens of thousands of pages) and could not find a suitable solution. It started with the import problem. I have lots of data in XML form (20k+ complex entries) that I want to import into ProcessWire. XMLReader() works fine but it takes a very long time to import all data so a simple "upload + process data on page save" would not work. So I've created a new module for this. Meet my first (well, third) PW module: Tasker. It's a simple module that executes long tasks in the background (using Cron or LazyCron) and reports their status to the user using a JQuery progressbar. Any suggestions are welcome. How do you solve similar problems? E.g. which is the best way to delete large number of pages? (max_exec_time will expire so I check it before the delete() call.) $children = $page->children('template='.$this->template.',include=all'); // creates lot of page objects, may not have time to delete all + ...->delete() OR $childIDs = $this->pages->findIDs('parent='.$page->id.',template='.$this->template.',include=all'); // will create page objects later + $pages->get(..id..)->delete() Be nice (I know you're always), I'm a PW-newbie, just started working with ProcessWire. I was developing sites with Drupal for a very long time but their non-existent module upgrade path finally has driven me away from it.
-
hi there i'm new to processwire, please cut me some slack if the answer is already out there.. i am "processwiring" a non-cms page that i made, containing many repeating so called "station"-elements with fields such as date, location, miles, optional links, photo upload etc. they were listed and created via php and stored in an xml file until now: <stations> <station> <date>17.8.2017</date> <location>Exil, Zurich</location> <miles>1234</miles> ... </station> <station> ... </station> </stations> i already created a working repeater field with the needed fields and successfully created the first two elements... but there are many more! what is the easiest and quickest way to batch create new repeater fields with the node element content of my xml file? otherwise i would just have to type the whole sh..t again which i am too damn lazy to do thanks in advance nuel
-
Good afternoon, I am attempting to loop through approximately 600 XML nodes. Each of those nodes has 2 child nodes (example below). One is an id for an existing page and the other contains values for a page reference field. I have put together a loop (below as well) to attempt to save each page with the label values. This all works....once. After getting the first XML node "label" saved to the correct page, nothing else is saved. I'm sure there is probably something that I have overlooked. But, I am also very new to this CMS. I'm hoping there is a veteran user who may be able to point me in the right direction. <row> <id>1041</id> <labels>lifestyle|savings</labels> </row> foreach ($xml->row as $items) { //get page id to update and set output formatting to false $blog_page = $pages->get('id='.$items->id); $blog_page->of(false); //create array from pipe separated label values $labelsArray = explode('|', $items->labels); //loop through array to get page ids by page name $labelIDS = array(); foreach ($labelsArray as $labelValue) { $labelPage = $pages->get('name='.$labelValue); array_push($labelIDS, $labelPage->id); } //add labels to label field in post $blog_page->labels = $labelIDS; //save page $blog_page->save(); }
- 2 replies
-
- page reference field
- php
-
(and 2 more)
Tagged with:
-
I'm going to be building a real estate website soon and am exploring my options. The site will have some pages that will be native to PW, but all their property listing information will come from an XML feed from an external provider. What's the best way to approach this? I've come across http://modules.processwire.com/modules/rss-feed-loader/ but is it possible to do searching, categorisation and pagination using that? Or is there a better way to approach it?
-
Hello, i have some trouble to generate the XML with ryans Script I always get an 500 error
-
Would anyone here be able and inspired to develop a ProcessWire equivalent to the WordPress plugin WP All Import Pro? or to help me do so? This is what I'm envisioning... Upon installation the module creates an admin page titled "Import & Update". On the module config page you can specify allowed templates to run this on, otherwise allowing any. Include the following PHP libraries: hQuery for web scraping, Csv for CSV handling, and Parser for XML. Create template "import-update". On the "Import & Update" page, a list of current import/updaters will be displayed (0 initially), each with corresponding links to "edit" or "run". When you "Add New", this be the "import-update" template (with all module-specific fields tagged "impupd"): title destination (req.): parent, template source (req.): type (web, csv, xml) location (url, file, text) if web: opt. index URL & link selector, + paginator selector if csv: opt. ignore 1st row if xml: req. individual item node xpath actions (check): import (if none matching UID) update (if matching UID & field values differ) save() [req. here in flow] map (repeater): input (select fields from specified template to affect) intake (corresponding DOM selectors / CSV col. letters/headers / xpath per field) (req.) UID (unique ID; field reference to compare against, from selected input fields) (req.) Lazy Cron interval Scripts can be run via the import-update template; keep logs; show preview (iframe/ajax) for manual runs. ...
-
Hi, I have one xml FEED and I want to create pages for each item in XML via API. First time i am trying to create page with API, every thing is working fine but the issue is 1. its creating duplicate pages every time i run that XML. i have one unique field in XML called item_id & i want to create page with item_id as page name, i want to check that if page exist with item_id name before creating page. how can i do that ? Thanks
-
I'm working on a site that is using the Goodreads API but I'm finding the page very slow to render so would like to speed it up by cacheing the output of the API. The page is made up of several child page 'bundles' each of which displays a selection of books which are chosen with a repeating field containing ISBN numbers. $goodreads_api = 'xxxxxx'; foreach($page->children as $bundle) : foreach($bundle->goodreads as $goodreads) : $xml_string = file_get_contents('https://www.goodreads.com/search/index.xml?key='.$goodreads_api.'&q='.$goodreads->isbn); $book_xml = new SimpleXMLElement($xml_string); foreach ($book_xml->search->results->work as $book) : // content goes here endforeach; endforeach; endforeach; I've looked at the Markup Cache module but when I try cacheing the second foreach loop, I get the correct number of bundles and the correct number of books, but same output for every book. If I cache the first foreach, I get the correct number of bundles, but only one book and again, the same content for each bundle. So is Markup Cache the way to go, and if so, what am I doing wrong, or if not, what else should I be looking at?
-
Hello, Been trying to import some data from wordpress and the migration tool with MigratorWordpress installed finishes but then there isn't any content added to my install. I've selected home or /News as parent pages to import to with no avail either time. Import select set to everything. The import xml file is in excess of 17mb if that makes a difference?
- 1 reply
-
- MigratorWordpress
- xml
-
(and 1 more)
Tagged with:
-
I'm currently developing a website and we need to get some information from an external provider for display on a few different sections of the site. We have a couple of different options - an xml feed or information provided as an iframe. I'd rather go the XML route and have full control over how we display the information, but I've not really dabbled in XML before and I'm a bit lost on where to start with this. Should it be possible to use the MarkupLoadRSS as a starting point for this?
-
Hi Guys, I have just started to experiment with Processwire and really like what I see so far. I am hoping to try my first production site on it soon. I have long been a wordpress user, but want something new and more efficient. I am wondering if there is a module/feature similar to this for wordpress: http://www.wpallimport.com/ it's a full XML importer where you can import to create new pages (posts on wordpress) and map parts of each entry to certain fields of each page. Is this possible for Processwire? I use this with the advacned custom field plugin on wordpress to great effect. Each time the plugin is run, it will update the posts if they have already been created, and add new ones for new entries in the XML feed. I've seen this module, but does it work with the latest version, and could it work with what I need: http://modules.processwire.com/modules/process-data-import/ If anyone can point me in the right direction I would appreciate it. Thanks, Aaron