-
Posts
4,088 -
Joined
-
Last visited
-
Days Won
88
Everything posted by horst
-
Image fields stop saving descriptions after a while
horst replied to OviS's topic in General Support
One thing that I spotted in this thread is the change and cycle through different image fields and PW version on one Site at least, PW 2.3 to PW 2.6 now. Also the use of cropableimages, what is clearly signed as alpha state. There were some changes needed and done to the naming scheme of image variations between PW 2.4 to 2.5 and also 2.5 to 2.6. So I believe that not all 3rd party image fileds are up to date with that. And that switching between different versions, forth and back, and than change PW versions too somewhere in between, maybe this can render a DB corrupt in some parts. At least I have had some weirdness with image fields too in the past, but that definetly was produced by switching and hoping through different image fields and PW versions, including the use of third party alpha modules. (not proper functional install / uninstall routines, maybe a server - / DB connection interrupt at the wrong second, all this can be an initial point for a damage in the DB) I don't think it has to do with the base core image field (since) PW 2.3 or earlier. How many installations out there with PW? How many people are arriving here with a problem like that? Not to be able to change / save images and / or descriptions, there would be more reports here to read. Sorry that it doesn't help in any of the problems -
How have you linked the pages to the subjects? WIth which field(s)? Do you use an InputfieldPage for that? What does this function do: findartworks("subjects=$subject, limit=1") ? You call it two times.
-
There is a setting in the Input Tab, named Extra Allowed Content, where you can define what shouldn't be stripped by CKEditor. On the other hand, if it is your side and you are the maintainer, just swicth off the use of ACF !
-
All you have changed in the script looks good, but ... ;-) ... the only thing what doesn't seem right is your main template dams (what I have named rccdams). This must be used for the combining (normal) dam pages. It cannot be used for a Inputfield of type "Page". You need to have that main template dam (or even dams and dam, if you give the parent page of all your dams an own template too.) The main template you need to refer to in the script is the dam template. This is used for all your dam objects. It will hold all other fields in the edit screen for the maintainers of the data. All other fields mean: all InputfieldPage, all InputFieldText, all inputFieldInteger, all InputFieldDatetime that contains data belonging to a (single) dam. Templates and fields of type InputFieldPage for (type, owner, country, purpose) needs to be created manually, before running the import part. (This looks good in your script config) All fields other than that of type InputfieldPage will be created by the createFields Action of the importer script. You need to run this action first. (looks also good in your script config) All other things, e.g. if you want to use more / other fields of type InputfiledPage depends on you. You should look and play a bit with the starter profile I have provided earlier. It shows some purposes as categories and how to use them with a multiple categories InputfieldPage that can be added to single dams. Also there is a single category InputfieldPage to study and play with. In my example, I have used the FIW exmple you provided in an above post. So, if you now do not have this field, you also can specify some source-fieldnames that you don't want to use as single inputfields but first gather their data, and put it together in a way that it fits to the purpose filed I have build, or you change the purpose field to match other criterias. My purposes categories do not only have a title field but also a subtitle field. You can see all this in the site profile. It's easy! And, if you have ran the import and the resulting data isn't what you expected, you once can run the deleteImportedData action to clear it out, change the config or change fetching and preparing the data of that particular part(s). And finally run the importer again. Good luck.
-
Maybe it is what is said here in the first answer: http://stackoverflow.com/questions/10338279/unable-to-show-fancybox-title ?? put the description in the title attribute of the a tag, not into the alt attribute of the img tag. >> unproofed, only found!
- 75 replies
-
- 1
-
-
- site profile
- responsive
-
(and 2 more)
Tagged with:
-
Hi, a very useful Modul(ette). Primarily, it is not the "amount" of code what tells about the "weight" of a module. ------ BTW, when having a look at Github, I spotted DIRECTORY_SEPARATOR in URLs for script and style loading. Shouldn't it be a simple / (slash) instead?
-
Hi Tony, I have attached a site-profile as example. It has some data in it that was populated with the following importer script. In the site profile I have created the dam_type and the dam_purpose categories and page fields. The dam_purpose was created as Multiple categories and there will be no items added automaticaly during import. The dam_type will be added automaticaly during install. there is only the templates and the parent created manually. Inspect the profile and look through the importer script, it has all needed comments. After playing around with it, I'm sure you can adapt it to suite your needs. site-rccdams-starter.zip save this besides your PW index.php and call it after you have logged in as superuser: <?php $GLOBALS['templateName'] = 'rccdams'; // the name of the template you use $GLOBALS['oldrccid'] = 'rccid'; // the fieldname in PW which stores the id from the source DB $GLOBALS['parentPath'] = '/rcc_dams/'; // add the path you want the pages stored, e.g. "/rccdams/" or that like, but check that you already have created this (parent) page in PW!! // the templates and parent pages for the categories needs to be created manually before the import action is used!! // also don't forgett to assign them to the rccdams template !! $categoryPages = array( 'dam_type' => array( 'nameOfParentTemplate' => 'dam_type_category_parent', 'nameOfChildTemplate' => 'dam_type_category' ), 'dam_owner' => array( 'nameOfParentTemplate' => '', 'nameOfChildTemplate' => '' ), 'dam_country' => array( 'nameOfParentTemplate' => '', 'nameOfChildTemplate' => '' ), 'dam_purpose' => array( 'nameOfParentTemplate' => 'dam_purpose_category_parent', 'nameOfChildTemplate' => 'dam_purpose_category' ) ); # # ATTENTION: SELECT AN ACTION HERE !! # # select an action you want to proceed by comment uncomment the following two lines # $ACTION = 'deleteImportedPages'; #$ACTION = 'createFields'; #$ACTION = 'importData'; // provide the credentials to connect to the Source-DB, including DB name and Table name $MYSQL = array(); $MYSQL['host'] = '127.0.0.1'; $MYSQL['user'] = ''; $MYSQL['pass'] = ''; $MYSQL['dbname'] = 'rccdams_db'; $MYSQL['tablename'] = 'rccdams_db'; // a list with all the fields and the their types, you want create / import into PW $rccdams_fields = array( 'dam_type' => 'Page', 'dam_country' => 'Page', 'dam_owner' => 'Page', 'dam_purpose' => 'Page', 'rccid' => 'Integer', 'dam_name' => 'Text', 'river' => 'Text', 'capacity' => 'Text', 'cd_proj_start' => 'Datetime', 'cd_proj_start_d' => 'Integer', 'cd_proj_start_m' => 'Integer', 'cd_proj_start_y' => 'Integer', 'cd_rcc_start' => 'Datetime', 'cd_rcc_start_d' => 'Integer', 'cd_rcc_start_m' => 'Integer', 'cd_rcc_start_y' => 'Integer', 'cd_proj_fin' => 'Datetime', 'cd_proj_fin_d' => 'Integer', 'cd_proj_fin_m' => 'Integer', 'cd_proj_fin_y' => 'Integer', 'cd_rcc_fin' => 'Datetime', 'cd_rcc_fin_d' => 'Integer', 'cd_rcc_fin_m' => 'Integer', 'cd_rcc_fin_y' => 'Integer' ); // I'm not sure if all the _d, _m, _y fields are needed. Maybe you only need the 4 Datetime fields! // you can adapt the list to suite your needs ############### READY with config part ########################### $GLOBALS['categoryPages'] = $categoryPages; $timeLimit = (60 * 5); // give it a bit more time than the default 30 seconds $ignoreUserAbort = false; // prepare server for plaintext output if(function_exists('apache_setenv')) @apache_setenv('no-gzip', '1'); @ini_set('zlib.output_compression', 'Off'); @ini_set('output_buffering ', '0'); @ini_set('implicit_flush', '1'); @ob_implicit_flush(true); @ob_end_flush(); if(isset($_SERVER['HTTP_HOST'])) { header('Content-Type: text/plain'); } // Bootstrap ProcessWire require_once('./index.php'); // security check if the current user is a SuperUser, comment the next line out, if you run this script from CLI if (!wire('user')->isSuperuser()) die('ACCESS DENIED!'); ignore_user_abort($ignoreUserAbort); set_time_limit(intval($timeLimit)); // Assign API variables to make things a little easier $fields = wire("fields"); $templates = wire("templates"); $modules = wire("modules"); $sanitizer = wire("sanitizer"); $pages = wire("pages"); echo "\n$ACTION\n"; if ('deleteImportedPages' == $ACTION) { echo "\n"; // we drop all imported pages foreach($pages->find("template={$GLOBALS['templateName']},include=all") as $p) { echo " - now drop {$p->title}\n"; $p->delete(); } echo "\nREADY!\n"; exit(); } if ('createFields' == $ACTION) { echo "\n"; // (1) first get the rccdam template $t = $templates->$GLOBALS['templateName']; if (!$t) { $fg = new Fieldgroup(); $fg->add("title"); $fg->save(); $t = new Template(); $t->name = $GLOBALS['templateName']; $t->fieldgroup = $fg; $t->save(); } // (2) loop through the field list and create those that are missing foreach($rccdams_fields as $name => $type) { echo " - $name :: $type\n"; if ('page' == strtolower($type)) continue; // field of type Page, this need to be created manually $f = $fields->$name; if (!$fields->$name) { // create a new field $f = new Field(); $f->type = $modules->get("Fieldtype" . $type); $f->name = $name; $f->save(); echo " successfully created\n"; } // add it to the rccdam template $t->fieldgroup->add($f); $t->fieldgroup->save(); $t->save(); } echo "\nREADY!\n"; exit(); } if ('importData' == $ACTION) { echo "\n"; // (1) connect to Source-DB $MY_sql = mysql_connect($MYSQL['host'], $MYSQL['user'], $MYSQL['pass']); if($MY_sql) { echo "- connected with MySQL Server\n"; $MY_sql_db = mysql_select_db($MYSQL['dbname'], $MY_sql); if($MY_sql_db) { echo "- connected with source DB\n"; $MY_sql_result = mysql_query("SELECT * FROM {$MYSQL['tablename']}", $MY_sql); if (is_resource($MY_sql_result)) { echo "- found the Table\n\n"; $t = $templates->$GLOBALS['templateName']; while($row = mysql_fetch_array($MY_sql_result, MYSQL_ASSOC)) { // (2) process all records of source table echo " -- fetched row with id {$row['id']}\n"; if (!isValidImportRecord($row)) continue; // this one is already present in PW, so skip further processing // we have data for a new page echo " this one needs to be imported\n"; $p = new Page(); // create a new page and assign the minimum required params: template, parent and title! $p->template = $t; $p->parent = $pages->get($GLOBALS['parentPath']); $p->$GLOBALS['oldrccid'] = $row['id']; $p->title = $row['dam_name']; // now loop through all source data fields foreach($row as $fieldname => $data) { if (!isset($rccdams_fields[$fieldname])) continue; // skip source data fields that are not defined in the $rccdams_fields array!! if (!$t->fieldgroup->$fieldname) continue; // skip source data when there is no field in our template // check which type we need in PW for this if ('Page' != $rccdams_fields[$fieldname]) { // we can simply add the source data into the target field, but pass it once through the sanitizer or typecast it to integer $data = 'Integer' == $rccdams_fields[$fieldname] ? (int)$data : $sanitizer->text($data); $p->$fieldname = $data; } else { // we have a Pagefield, we need to act accordingly, // here in the starter script I only work with dam_type and dam_purpose // the other needs to be added by you, switch($fieldname) { case 'dam_type': // this must be a single category Page !! in Details Tab it must set to SIngle Page or empty NullPage !! // we want create child pages for this category automatically, therefore // we need to check if there is already a child page, fetch this or create a new one: $data = $sanitizer->text($data); $cp = getCategoryPage('dam_type', $data); $p->$fieldname = $cp; break; case 'dam_owner': break; case 'dam_country': break; case 'dam_purpose': // this is a Multi-Items-Category and it has shortcuts in the source DB $data = strtolower(trim($sanitizer->text($data))); $cpa = getCategoryPagesPurpose($data); $p->$fieldname = $cpa; break; } } } $p->save(); echo " saved into DB!\n\n"; } mysql_free_result($MY_sql_result); } } } mysql_close($MY_sql); echo "\nREADY!\n"; exit(); } function isValidImportRecord($row) { // we check for a page with the rccdams template and the original id, (what we have stored under rccid with every imported page) $page = wire('pages')->get("template={$GLOBALS['templateName']},{$GLOBALS['oldrccid']}={$row['id']}"); // if a $page with ID greater than zero is found, we already have this page imported and want to skip it here, therefor we retun false! return $page->id > 0 ? false : true; } function getCategoryPage($name, $data) { $nameOfParentTemplate = $GLOBALS['categoryPages'][$name]['nameOfParentTemplate']; $nameOfChildTemplate = $GLOBALS['categoryPages'][$name]['nameOfChildTemplate']; // if there is no data in the source record, we return a NullPage Object if (empty($data)) { $cp = new NullPage(); } else { // if we have this page already in PW, we return it $cp = wire('pages')->get("template={$nameOfChildTemplate},name=" . wire('sanitizer')->pageName($data)); if (0 == $cp->id) { // if it ins't already there, we create it $cp = new Page(); $cp->of(false); $cp->template = $nameOfChildTemplate; $cp->parent = wire('pages')->get("template={$nameOfParentTemplate}"); $cp->title = $data; $cp->save(); } } return $cp; } function getCategoryPagesPurpose($data) { $nameOfChildTemplate = $GLOBALS['categoryPages']['dam_purpose']['nameOfChildTemplate']; $cpa = new PageArray(); // create an empty PageArray if (empty($data)) return $cpa; // if we have no source data, return empty PageArray for($i = 0; $i < strlen($data); $i++) { // add category pages to the array $cp = wire('pages')->get("template={$nameOfChildTemplate},name={$data[$i]}"); $cpa->add($cp); } return $cpa; } EDIT: I added the $ACTION "deleteImportedPages" to the script, and a few more comments. Please use this from above and not this that ships in the ZIP archive.
-
is Key-binding for STRG-S in Admin-Editpage possible?
horst replied to Pauline's topic in Getting Started
- interesting, but Google doesn't translate it correct: https://translate.google.de/?hl=en#auto/en/%D0%9F%D1%80%D0%BE%D1%86%D0%B5%D1%81%D1%81%D0%A8%D0%B8%D1%80%D0%B5 -
You can add a textformatter to that Field. drop the following code into a file named and located at site/modules/TextformatterRemoveEncodedSpaces/TextformatterRemoveEncodedSpaces.module <?php class TextformatterRemoveEncodedSpaces extends Textformatter { public static function getModuleInfo() { return array( 'title' => 'Remove Encoded Spaces ()', 'version' => '0.0.1', 'summary' => 'Removes that weird encoded spaces (& #160 from my Textareas!' ); } public function format(&$str) { $search = array( ' ' ); $replace = array( ' ' ); $str = str_replace($search, $replace, $str); } } install it and add it to the output of your textarea field.
-
I don't know exactly how you need your data to be organized, and how you import it, but I think best way would be if it is possible to import it in several steps. Maybe, that's exactly what you are said / asked me, - You need to do the import completly new. Here is the way hoa I would do it: First import or create all categories, create a parent page, e.g. like with the countries example, create the countries template and page. Then create the child template and import all items as children of the parent page. Repeat this for all other categories! (name, owner, country, dimensions, construction dates, construction methods, etc) If your categories are ready, you need to create the fields and templates (incl. template file(s)) for your main data pages. Also this will have one or more Page-Fields for the categories. When importing a record of the main data, you need to assign a category by a page field. If you can provide some informations about the data that you need to import, we can provide further help / assistance with an importer script. Is it in CSV file? Is it in a mySQL-DB or is it a mysql.dump? Can you provide at least one record with example data and all the fieldnames? Maybe it is also possible to import all at once, but therefore we need some more informations. Horst
-
Hi @joe_ma, not sure on this, but have you checked if this has nothing to do with copy pasting data from anywhere else into the textarea field? Or the otherway round: this behaves the same if you type manually the String "Tel. 044 461"? I haven't investigated further, but I'm wondering if the PHP entity encoder makes differences between spaces that are wrapped from numeric chars and spaces that are wrapped only from alpha chars or mixed alpha-numeric chars.
-
Have a look to the module SPEX. This is a very comfortable, more advanced and flexible ready to use system for that. It already has all the functionality for as many of layout-templates, Slots and more as you want to use. It is in the modules directory, the author is Jonthan Dart.
-
Hi Tony, have only a bit time now, but think I definetly can explain how to get this part with the page-fieldtype sorted. Best thing would be to start with a simple step by step solution: in admin, create a template without a file, called country and let it have only the title field. Save! create a second template, called countries (plural / multiples of country), only assign the title filed to it and: Save! go into your page tree and create a single page named countries, with the template countries, now add children to this page, all of them should have the template country, ok, now go into fields and create a new field of type "page", name it countries. In the Input tab of it, go to Selectable Pages, use Parent of selectable page(s) and click the change button you get the admin page tree now and have to go to your previously created countries (parent) page. Click select to select it! additionally to that, go to Template of selectable pages(s) and use the dropdown to select country, (the single page template) Now you can go to Input field type and select one that fits best your needs. For this example, please select the AsmSelect* ok, ready to save the field! Now go to a template where you want to be able to select countries or one country, - add the new created field "countries" to it and save. Open a page with that template or create a new one that bases of the template that now has the page field countries included. Go to the field and play around with it! You got it now? Go ahead and edit your countries field: under the Details tab select: Single page or empty page ... (this will restrict the field to let the user select only one child out of all available) if you don't like the AsmSelect, go to Input tab and select another one, best would be Select now? save it and test your changes. Come back here if you don't get it i to work.
-
There is a module in the directory, called "Simple Contact Form".
-
I don't use it continuously, but when I need it, I save it with my primary "good for everything editor" NoteTabPro into Outlinefiles, or into an editors own format. This can be done easy within an editors sidebar.
-
New Installation: Field to upload site-profile
horst replied to bernhard's topic in Wishlist & Roadmap
as I know and understand the access rights in unix (and other) systems, the parent directory need write access. The parent directory for most PW installations is the webroot! Besides that in many shared environments you will not be able to change access rights for the root directory, I also wouldn't do that if I could. -
the ready.php is a new thing, introduced in the current 2.6.7 DEV branch. If you are running PW with a lower version number, it isn't usable then. read more in the blog post here: https://processwire.com/blog/posts/processwire-2.6.7-core-updates-and-more/
- 21 replies
-
- admin
- admin theme
-
(and 1 more)
Tagged with:
-
New Installation: Field to upload site-profile
horst replied to bernhard's topic in Wishlist & Roadmap
Sounds good at first, but would need write access to the root directory for webusers, what, I think, isn't acceptable for that little comfort. Just my two cents. -
if you want to search the forum for interesting things, best is to use google with a search like this site:processwire.com/talk -"Viewing Profile" fieldset The part site:processwire.com/talk and the -"Viewing Profile" part are what I use every time, appended with my searchterms I actually looking for. If you use this, you will get many useful links like: https://processwire.com/talk/topic/1057-template-editor-fieldset-indentation-and-checkbox-columns/ https://processwire.com/talk/topic/176-fieldsetopen-fieldsettabopen-%E2%80%93-what-is-it/ https://processwire.com/talk/topic/665-editing-fieldsets/ https://processwire.com/talk/topic/7608-fieldset-grouping-in-admin/ The ip.board searchfield is not helpful. You can also use the google serach with /docs/ instead of /talk/, if you want to quick search in API and other docs. Happy reading!
-
Not 100% sure, but besides the default admin theme, the RenoAdminTheme, that is shipped with the PW core, seems to be the only public one at the moment. But there are also possibilities to only change the colors of those Themes or to fork and slightly modify them. For this, please refer to some threads: https://processwire.com/talk/topic/7625-reno-theme/ https://processwire.com/talk/topic/7238-release-apertusadmintheme/ https://processwire.com/talk/topic/8226-my-backend-redesign/
- 1 reply
-
- 1
-
-
Prevent field from updating page edit timestamp
horst replied to statestreet's topic in General Support
The fields modified and modified_users_id are in the table pages. If there is no direct API based way to manipulate it, one can read the values before a page is updated via the lazycron script, and set the values back afterwards, via direct access to the DB table. But I highly recommend to read this (complete) thread: https://processwire.com/talk/topic/8188-edit-created-and-modified-date/- 2 replies
-
- fields
- timestamps
-
(and 1 more)
Tagged with:
-
Many hostings operate with different data centers in different locations or around the globe. Here are a view few of them: http://www.eleven2.com/ http://www.hostsg.com/ http://www.site5.com/ http://www.vps.net/
-
without looking into the code, - maybe it will work when you select the array of items as formatted return value, under FIELDS -> images -> Details -> Formatted Value. (?) BTW, this module is in alpha state. ;-)
-
Exceeds max allowed file size error on live server
horst replied to Ivan Gretsky's topic in General Support
only some thoughts: what are the settings for upload_max_filesize and post_max_size for PHP? (maybe you can change them in the .htacces file if you have no access to the php.ini, or you can use the php function ini_set to change them) what module is it? Does it have settings for max filesize, that maybe gets reset to default on the live server? does the form, that is used for upload, have a HTML5 setting for MAX_FILE_SIZE ? <input name="MAX_FILE_SIZE" value="1000000" type="hidden" /> -
It would be fine! http://flif.info/