Jump to content

Search the Community

Showing results for tags 'Import'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development


There are no results to display.

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 44 results

  1. So I ran into a snafu the other day and all my fields etc were deleted. I do Have a backup of the fields, but was wondering how to I go about importing this rtf into processwire. Nvm, I was stupid.
  2. Hello together, I had a deeper look into the forum but didn’t found anything, so I like to ask the following simple question. Is there a module or a simple technique to export all users from the backend into a file? Afterwards, it should be possible to import the users again. I have a ProcessWire installation on a dev server and I don’t like the idea to add all users again by hand on the live server Thanks so much for your ideas. -Thomas
  3. I'm creating a general function for batch import, for a site migration, and while looping through fields (field names) to be imported for a page, I need to check whether the field is an image (or other file type), so that it can be imported after the first pave save. What would be the recommended way to check this, with PHP code?
  4. Hi I'm new to PW so please be nice I've an existing site that I have backed up from previous host. Trying to move it to new host presented some errors so I decided to start fresh. I've a fresh install working OK but I'd like to import the old site to the new site. What's the best process to do this? Thanks for your help R
  5. Hello, I was getting a setOutputFormatting error for a CKEditor field that had Content Type set to "Markup/HTML with image management" while trying to save HTML to that field in the course of importing about 150 pages through the API. This happened although $p->of(false) was set. It took me quite a while to figure out that this error was thrown only when there were image tags in the HTML that should be saved to that field. Then I went and switched Content Type for that field to "Unknown". Now the import worked fine. After switching Content Type back to "Markup/HTML with image management" and running the import again, there were no errors anymore. I just thought I'd mention this here in case someone else is facing similar problems. This happened on a 2.6.15 dev install.
  6. In my home.php (a template, as you'd expect for the homepage) then I take a look at the URL segments. I want to provide some shortlinks, e.g. example.com/php redirects to example.com/languages/php/. That all works. But if I want to display a 404, by using "throw new PageNotFoundException();" then things go pearshaped: Fatal error: Cannot redeclare renderNav() (previously declared in /var/www/pw/public_html/site/templates/_init.php:20) in /var/www/pw/public_html/site/templates/_init.php on line 20 I'm not sure how to get around this? (or exactly why it's coming up) This is the case if I try to declare a 404 at the top of any template.
  7. Hi, i want to import stuff from Drupal to Processwire and have create an importscript but some things doesn't work. I import a list of questions from users and i will manipulate the page created date (thats work fine) and change the User to the right one. If the User dosn't exist, i will creat a new one. But this is the first problem i have, no user will be change or create... The second problem is to find out if the page does alrady exist or not. If the Page exist i will only modify some fields, otherwise i will create a new page..... To find out if the Page exist and whats the Page ID do i also need to import the Comments..... readCSV.php: // Read the CSV file and get an array of rows function readCSV($file){ $lines = array(); foreach(file($file, FILE_IGNORE_NEW_LINES) as $line){ $lines[] = str_getcsv($line); } return $lines; } import.php: while($i < $countArray){ // Initzalisierung der Variablen $title = $data[$i][0]; $date = $data[$i][6]; #$summary = ''; $body = $data[$i][1]; $categorys = $data[$i][4]; $tags = $data[$i][3]; #$images = ''; $authorName = $data[$i][5]; $sanitizTitle = $sanitizer->pageName($title); $post = $pages->get("template=$template, name=$sanitizTitle"); if(empty($post)){ $p = new Page(); // create new page object $p->template= $template; //set template post $p->parent = wire('pages')->get('/$parent/'); //set the parent $p->name = $sanitizTitle; // SANITIZE!!!! $p->title = $title; // added by Ryan: save page in preparation for adding files (#1) $p->save(); $p->created = $date; // Timestamp!!! $p->save(array('quiet' => true)); // To save the created Date $p->body = $body; // $p->summary = $summary; // Looking for the inizialisation $p->tags = $tags; $p->categories = $categorys; $p->save(); echo 'Created Page: '. $title .'<br>'; $authorNameSanitiz = $sanitizer->name($authorName); if($users->get($authorNameSanitiz)){ $authorID = $users->get($authorNameSanitiz); $p->createdUser->name = $authorID; } else { $u = new User(); $u->name = $authorNameSanitiz; $u->addRole("author"); $u->addRole("guest"); $u->save(); echo 'creat User: '. $authorName .'<br>'; $authorID = $users->get($authorNameSanitiz); $p->createdUser = $authorID; } $p->save(); #} // populate fields //$p->images->add('path/to/image1.jpg'); // add multiple to images field $i++; } The CSV: "Titel","Inhalt","E-Mail","Schlagworte","Thema","Benutzername","Beitragsdatum" "digitale Filme in der Strahlentherapie","Hi,<br>zur Zeit suchen wir in unserer Abteilung für Strahlentherapie in Regensburg eine digitales Filmsystem.<br>Welche Firmen bieten den solche Systeme für die Strahlentherapie an?<br>MfG<br>Jan<br>","janmee@web.de","","Strahlentherapie","pete","1437587189" "Gehalt MTA R","Hallo,<br>ich interessiere mich für den Beruf. Wo kann ich erfahren, was ich ausgelernt verdiene? Gibt es einen Tarifvertrag? In welchem ist man da wie eingruppiert? Vielen Dank<br> <br> <br> <br> <br> <br>","sweetmic@web.de","Gehalt","Radiologie","guest","1437303471" what am i doing wrong?
  8. Hello, i try to write an Import Script. Some basic skills i've learned from different postst. But its not really enough so i try to start a new Topic. I have an zip file with xml and images inside. The different objects have three different actions "ADD | CHANGE | DELETE" so the Idea is at the ADD Action to check is the page ID I use for the ID the Object Number alredy exist. If not create page if the Change Action than check if ID exist grab this Page and write new values if Delete Action then Grab this ID if exist and change Parent. IMPORTANT: After all I have to delete the Zip file and all the TEMP Files. How to handle in the right way temporary fils with processwire ? Maybe i dont need the external extract Script ? This is my current CODE: <?php $userRolesSelector = 'superuser'; // bootstrap ProcessWire. Update the path in the include if this script is not in the same dir include("./index.php"); if( ! wire('user')->hasRole($userRolesSelector)) { header('HTTP/1.1 403 Forbidden'); exit(1); } include "import/op_file.php"; // Different functions to handle the zip file EXTRACT Read etc.... // here some (pseudo/example)code set_time_limit( intval(60 * 5) ); // give it 10 minutes, you may also increase this echo "<pre>"; readXML(); exit; //******************************************** /** ----------------------------------------------------------------- * @desc Finde XML/ZIP, entpacken und einlesen der daten */ function readXML() { $opfile = new OPfile(); // dbg is a wrapper for "echo", so you can ignore it via one Flag in op_tools echo "DOC ROOT: ".$_SERVER['DOCUMENT_ROOT']; // Set your path here ... $ropa=dirname($opfile->GetTheRoot())."/"; //opfile $ropa=$ropa . "demo/"; echo "ROOT: ".$ropa; $modpa=$ropa; $projpa=$ropa; $origfolderfrom=$ropa."import/ftpin/"; $ftptemp=$ropa."import/temp/"; $folderfrom=$origfolderfrom; // Find the ZIP/XML File in the FTP Folder // $fileinfo will be used by following functions. you can add more information if needed $fileinfo= $opfile ->GetUpload($origfolderfrom ); // return = assoc-array $fileinfo ['temp']=$ftptemp; $fileinfo ['folder']=$origfolderfrom ; // Extract or Copy the Files, so we can prozess the xml info if ($fileinfo['type'] =='zip') { // if it is ZIP , extract it to temp $xmlfilename= $opfile ->ExtractZIP($fileinfo); echo "<p> XML ist:".$xmlfilename."</p>"; echo "<p>Kopiere: " .$fileinfo ['folder'].$xmlfilename ." <br> nach: ". $ftptemp.$xmlfilename."</p>"; }else{ // if it is XML copy it to temp $xmlfilename = $fileinfo['file']; copy ($fileinfo ['folder'].$xmlfilename , $ftptemp.$xmlfilename); echo "<p>Kopiere: " .$fileinfo ['folder'].$xmlfilename ." nach: ". $ftptemp.$xmlfilename."</p>"; }//if // XML File from temp folder $stat = $opfile ->LoadXML($ftptemp.$xmlfilename); $path = $ftptemp.$xmlfilename; if (file_exists($path)) { $xml = simplexml_load_file($path); echo "<p>Erfolgreich geladen <br></p>"; $nodeList = $xml->xpath('//immobilie'); } // you can access the XML Object by: $opfile ->XMLdata; if ($stat == true) { // read basic infos form XML File $xinfo= $opfile->decodeUTF8($opfile ->XMLinfo()); // print_r($xinfo); echo "Objekte im Import: ".$xinfo['anzimmo']."<br >"; echo "Anbieter ID: ".$xinfo['anbieterid']."<br >"; }else { // Error in Processing. Stop the run. $xinfo['anzanbieter'] =0 ; $xinfo['anzimmo'] =0; echo "Fehler In der XML Datei"; // exit can be put away. The For Loop does not run with azi=0 exit; }//if $azi=intval($xinfo['anzimmo']); // get the number of Objects in archive // save our start time, so we can find which pages should be removed $started = time(); // keep track of how many changes we've made so we can report at the end $numChanged = 0; $numAdded = 0; $numTrashed = 0; // the parent page of our items: /about/what/ is a page from the basic profile // update this to be whatever parent you want it to populate... $parent = wire('pages')->get('/about/'); if(!$parent->id) throw new WireException("Parent page does not exist"); for ($ni=1; $ni<=$azi;) { //$xinfo['anzimmo'] echo "<h2>=======Object=".$ni."======</h2>"; $idata = $opfile->GetOneImmo( $ni, $xinfo); // $idata stores all the values in the Array for current Object $action=$idata['verwaltung_techn'] ['aktion']['aktionart']; if ($action =='') { $action="ADD"; }//if $page = wire('pages')->get($idata['verwaltung_techn']['objektnr_extern']); if($action == 'ADD') { if(!$page->id) { $page = new Page(); $page->parent = $parent; $page->template = 'immo'; // template new pages should use $page->name = $idata['freitexte']['objekttitel']; echo "Adding new page:".$idata['verwaltung_techn']['objektnr_extern']." Titel ".$idata['freitexte']['objekttitel']." <br>"; $numAdded++; } // print_r($idata); // now populate our page fields from data in the feed $page->of(false); // ensure output formatting is off $page->title = $idata['freitexte']['objekttitel']; $page->summary = $idata['freitexte']['dreizeiler']; $body = "<h2>".$idata['freitexte']['dreizeiler']."</h2>"; $page->body = $body; } if($action == 'CHANGE') { echo "CHANGE"; if(!$page->id) { $page = new Page(); $page->parent = $parent; $page->template = 'immo'; // template new pages should use $page->name = $idata['freitexte']['objekttitel']; echo "<h2>Change page data:</h2>".$idata['verwaltung_techn']['objektnr_extern']." Titel ".$idata['freitexte']['objekttitel']." <br><br>"; $numChanged++; } } if($action == 'DELETE') { echo "DELETE"; $numTrashed++; foreach($changes as $change) echo "\nUpdated '$change' on page: $page->name"; } $ni++; }//for Object echo "\n\n$numAdded page(s) were added"; echo "\n$numChanged page(s) were changed"; echo "\n$numTrashed page(s) were trashed\n"; }//funktion ?>
  9. Hello all, on a new project I want to use https://github.com/stevenrskelton/flag-icon which implements svg icons for country flags via webcomponents import. In the <head> I import the webcomponents polyfill js and the flag icons html with <script src="<?php echo $config->urls->templates; ?>bower_components/webcomponentsjs/webcomponents.min.js"></script> <link rel="import" href="<?php echo $config->urls->templates; ?>bower_components/flag-icon/flag-icon.html"> But I get a 403 error: NetworkError: 403 Forbidden - http://dev/pwtest/site/templates/bower_components/flag-icon/flag-icon.html For testing I did: 1. a clean install of html5-boilerplate (not in PW), added flag-icons through bower and linked the resources as above. Here I don't get the 403 error. 2. a clean install of processwire with the blank profile, added flag-icon through bower and linked the resources as above. And here I get the error again. I did this on 2 different servers. Same result. I also checked permission of the import file and they are fine (644). Then I tried to make a demo install on lightning.pw but the service exits with "We're sorry, but something went wrong." To me this seems to be a ProcessWire related problem. Maybe somebody can confirm this or has an idea what is happening? Thank you.
  10. Hello, I exported a profile of a running live site (PW 2.5.2) with ProcessExportProfile module. Then cloned latest stable branch 2.5.3 to my local vagrant box dev server, copied the exported profile folder into PW root and installed. Everything went smoothly so far. All my templates, fields, modules and template files are there. I can access all but one specific page of my site. That page always throws a 404 error. The page sits under /profile and has template userprofile assigned. It is published and not hidden. The template file site/templates/userprofile.php is there. Only difference to the working pages is that this /profile page requires login before it can be accessed. After successful login the user is redirected to the /profile page with if($user->isLoggedin()) $session->redirect($pages->get('/profile')->url); But also if I enter the URL path manually, I get the 404 error. On the live site /profile only throws a 404 if you enter the URL path manually and are not logged in. So on my local install the /profile page acts as if the user was not logged in even if the user is logged in. I checked that the user really is logged in with if($user->isLoggedin()) echo "LOGGEDIN"; and has the correct roles with if($user->isLoggedin()) echo $user->roles; I haven't made any changes to my userprofile.php or any other files in the fresh install. And the code in there is working perfectly fine on the live site and on a copy of the live site that runs in the same dev environment as the site I'm having problems with. Now I'm really lost and don't know which steps to take for debugging this (debug is set to true in config.php - no messages or errors). Any help would be greatly appreciated. EDIT: I also installed the site on a different non local server to be able to rule out server environment issues. But same behaviour. Still get 404 for profile site
  11. Hi everyone, i've build the recommended setup for processwire to work with tags, which means i have a page tree "Tags" and this page tree hold several title-only pages, each represents a tag. for the gallery items i like to tag, i've build a template with an categories field of the type "page", this template will be used by every item to hold the tags. the field is "free tagging" field, so it would create the tag-pages autmaticly. now i need to import a csv file and this is where i have a problem: when i'm using "the import pages by csv" module, i am not able to select the category field as csv target. the tags column of my csv holds comma separated words as tag, so the schema looks like this: PICTURE NAME | TAGS ---------------------------------- Some title | birds, unicorns, kittens Another title | hearts, stars, pie so i need to be able to select a page reference field as target for the TAGS column of the csv, and for every comma separated word i need to create a page tag automaticly and add this tag to the gallery item i hope it's understandable what i like to do, otherwise feel free to let me explain it again
  12. This works for me to support page references in Ryan's ImportPagesCSV.module, in function importPageValue: elseif($field->type instanceof FieldtypePage) { $value = trim($value); if(wire("pages")->find("$name=$value")) $page->set($name, $value); } I need to also be able to import repeater fields though.. Anyone know how to do that?
  13. Disclaimer This is not a step by step tutorial, but the script posted serves as an example of how easy it is to bootstrap ProcessWire(PW), query an external API (in this case, Strava) and import stuff into PW pages using the PW API. To the import! So i wanted a quick, easy and automated way to import someones Strava activities into his/her own 'activity feed' on a certain PW website. Strava has an API which you can use to -amongst other things- get your own activity data. After setting up my Strava app i had access to the API. Next step was to import the JSON data i wanted into PW pages. This was as easy as creating a PW bootstrapped script (see code below) and using the PW API to import the data into Pages. For convenience in talking to the Strava API i used a library that is available on Github. To keep track of what was happening i decided it would be nice to log the import results to a log file. Luckily, PW had me covered by using the WireLog class (/wire/core/WireLog.php). Result With some googling on Strava and a (very) basic knowledge of PHP and the PW API i was able to get things working in no-time. With no other CMS i've worked with -and i've had dealings with quite a few- it would have been so easy to get the desired result. Some notes about the script: PW version used: 2.4.12, but should work in earlier versions as well. It does not create templates, fields and pages for you. If you would want to use it (maybe as a starting point), create templates, fields and pages for your own needs and adjust the script accordingly. Also remember to adjust script paths. In the posted example i don't do any sanitizing on the Strava data. You maybe should In production you would maybe call these kind of importers via a cronjob, and make it non-accessible from the outside. It served my purposes. There might be better ways of handling this stuff. All suggestions and/or questions are welcome. In this case the script was/is called importer_strava.php , located at mydomain/importer/importer_strava.php and requested manually. See notes above, number 3. <?php /** * Strava Importer * * This crude script will import your own Strava activities into newly created * PW pages under a given parent page. The import result will be logged in: * /site/assets/logs/importer_strava.txt, using the WireLog class. * * For this to work you first need to create an app via http://www.strava.com/developers * Strava API reference: http://strava.github.io/api/ * * The PHP library used for working with the Strava v3 API can be found at: * https://github.com/iamstuartwilson/strava * */ // Bootstrap Processwire include __DIR__ . '/../index.php'; // Include the PHP Library for working with the Strava v3 API include __DIR__ . '/StravaApi.php'; // Strava credentials (you can get these from the Strava app page you've created) $clientId = "Your clientId"; $clientSecret = "Your clientSecret"; $accessToken = "Your accessToken"; // Connect to Strava $api = new StravaApi( $clientId, $clientSecret ); // Set the parent where activities will be stored as child pages $activity_parent = wire('pages')->get("/activities/"); // Get new activities $results = $api->get( 'athlete/activities', $accessToken, array( 'after' => $activity_parent->strava_last_checked ) ); // Uncomment if you want to inspect the $results response onscreen // echo "<pre>"; // print_r($results); // echo "</pre>"; // Import new Strava activities to PW Pages if (empty($results)) { // Log that no activities have been imported $text = "No new activities have been imported"; $options = array('showUser' => false, 'showPage' => false); wire('log')->save('importer_strava', $text, $options); } else { $numImportedPages = 0; // Start counter for number of imported pages foreach ($results as $result) { $p = new Page(); // Create new page object $p->template = 'activity'; // Set template $p->parent = $activity_parent; // Set the parent // Assign $result data to the corresponding Page fields $p->name = $result->id; $p->title = $result->name; $p->act_distance = $result->distance; $p->act_moving_time = $result->moving_time; $p->act_elapsed_time = $result->elapsed_time; $p->act_total_elevation_gain = $result->total_elevation_gain; $p->act_type = $result->type; $p->act_start_date = substr($result->start_date_local, 0, 10); $p->act_average_speed = $result->average_speed; $p->act_start_lat = $result->start_latlng[0]; $p->act_start_long = $result->start_latlng[1]; $p->act_end_lat = $result->end_latlng[0]; $p->act_end_long = $result->end_latlng[1]; $map = $result->map; $p->act_map_polyline = $map->summary_polyline; $p->save(); // Save the Page object $numImportedPages++; // Increment counter } // Log the number of activities that have been imported $text = ($numImportedPages == 1) ? "$numImportedPages new activity imported" : "$numImportedPages new activities imported"; $options = array('showUser' => false, 'showPage' => false); wire('log')->save('importer_strava', $text, $options); // After the import, update Field 'strava_last_checked' to current Unix timestamp // This could also be placed outside of the 'else' to update on each script run $timestamp = $activity_parent; $timestamp->of(false); // Turn off output formatting before saving things $timestamp->strava_last_checked = time(); $timestamp->save('strava_last_checked'); }
  14. Hey guys, I need to import a Jekyll-based website, basically a collection of 3000+ static html pages, into ProcessWire, or in other words, import them into PW's database. Is there an easy, automated way to do this? Could you please point me in the right direction? Thanks.
  15. I did a big beginner mistake. I've deleted MAMP PRO to use XAMPP and in the process of the uninstalation of MAMP PRO I deleted all my databases... Fortunately my projects are already live so I have a working copy on the FTP of my client. I would like to have all this data as it is online so it works local on my computer. This is working with a processwire CMS, the url is http://www.fem-k.com/ if in need... Please let me know how to solve this problem so I can go on playing with processwire on my computer. Thank you very much!!!
  16. I m updating an old install of PW onto a new server with latest version of PW. Have changed alot of stuff but am still looking to retain some pages: e.g. all the news children pages. Been trying to use the import from CSV module for this by exporting using mySQL but im not really sure what im doing and I've managed to get an CSV with the page titles but not any content - Is there an easy way to do this? Or does any one have a module or mySQL script to select all the pages with child of id=x in a form they can be imported? Thanks!
  17. Hi, folks! We're working on our first big website project using ProcessWire. We're no longer in "fiddle and play with PW" mode. We're committed. My question: The site will have a directory of organization members, each needing a login/pw and a profile page. We're planning to use the existing Users/Roles model of ProcessWire, but we need to generate several thousand users from a pre-existing text file. Now, I won't have a problem writing a plain PHP script to parse the text file and interacting with the database. BUT i could use some help understanding how the user details and fields are laid out in PW's default install. I'm discovering, as many of you already know well, that even users are just pages. This, however, makes it a bit less than obvious how one might generate users programmatically on the fly. I would welcome any input or guidance you might have in helping me know *where* to insert *what* into the DB schema. I'd also welcome any anecdotal experiences you may have had doing something like this yourself. Caveats?
  18. Hello everyone, I'm new to Process Wire and I'm trying to set up a website for a magazine. My first task was to import a bunch of videos from another site into PW and it actually worked out quite good. Now I've got a bunch of pages with an external image reference in the image field. My idea was *not* to copy the whole lot of images, but to download and resize the ones that are requested. The first naiive attempt was this: <img src="<?=$article->video_image->size(350,88)->url; ?>"> With 'video_image' being a full path to an image on another remote server. Soo ... that didn't work. Do I need to copy the image to my server before resizing it? Or is there a trick to resize it and save only the "new" image on my server? Thanks for any help! Loving PW so far! thomas
  19. Below, I'll write how you can move your site from Drupal to ProcessWire. It's quite simple. In Drupal you will need: - Views Module, - Views Data Export Module, - Views UI Module (integrated with Views), - Chaos tools Module - required by Views. Install these modules and switch them on. In ProcessWire you need only: - CSV Page Import Process (Import Pages from CSV). Install this module. When you are ready, you have to create a new View (select: "Create a page") in Drupal with all fields which you want to export. Then, add "Data export" subpage and make sure, that format is CSV file. It's a good idea, to use Pager when you have lot of nodes (pages). You have to setup an url to download your CSV files. When you are ready - download your data. Next step: In ProcessWire, you have to prepare a template with your fields. When that's finished, you can import your data from CSV files using "CSV Page Import". That's all. If you have any questions, write them below. I can also write complete scenario for my website (if there will be anyone interested in that).
  • Create New...