Jump to content


  • Posts

  • Joined

  • Last visited

About bilioso

  • Birthday 08/07/1952

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

bilioso's Achievements

Jr. Member

Jr. Member (3/6)



  1. Thanks, Snobjorn. Much cleaner now. However, it turns out that the selector doesn't accept variables and operators like $page - the concept is right, but the peace of code won't work. The solution I could find: $selector = "template=article, fieldAuthors=" . $page . ", sort=-published"; $articles = $pages->find($selector); foreach($articles as $article) { #... } Note: The messy nested iteration in my first solution resulted from my (wrong) notion that because fieldAuthors is an Array, I should iterate to find the right value. Well, I was surprised to find out that the selector "fieldArray=someValue" magically iterates through fieldArray to find someValue. The code is working, but please correct me if I'm wrong on this note, I don't want to induce other apprentices into mistake. Otherwise this issue is solved.
  2. Sorry, silly me. I found the origin of my failures on points 1 & 2 reported in my previous post: 1. & 2. After loading the plugins into /site/modules/InputfieldCKEditor/plugins I simply forgot to activate them in the setup of the field where I want to use them, e.g. setup > fields > body > input > plugins > extra plugins
  3. I'm having difficulties on building some aspects of my site, namely with textarea/ckeditor input fields. 1. <no break space> is an essential feature to my site. I tried to install a ckeditor plugin for &nbsp; but it doesn't work. Is it possible I'm doing something wrong, or doesn't the PW's ckeditor accept plugins? 2. <footnotes> is another essential feature in my site (lots). Same problem - tried to install the ckeditor plugin without success. Or: is there common alternative solutions to use notes in a html page? (I mean, not necessarily foot-notes) 3. When there is a link with an associated anchor, on calling the editor window for the link, the PW links plugin for ckeditor wipes out the anchor. Annoying. Is there a solution for this? 4. This brings me to an old situation: I always had problems and limitations with ckeditor, which always led me to opt for tinymce in my previous sites. But, as far as I can understand, PW 3 doesn't support any more tinymce. Am I wrong? 5. <images> input field does not allow for using a css class. I couldn't find a module to solve the problem, is there one? 6. What is the best practical solution to insert images residing somewhere in the net, without having to go fishing inside the html code source for the text? Thanks in advance for any help.
  4. I'm still working on migrating my site from Drupal to PW. It will take very long, because I have to do it in my spare time, which has been none lately. My experiments on this subject are not interesting, compared to some other threads on the same subject in this forum and I would not be offended if the moderators opt for deleting this thread, namely to avoid confusing more other newbies. Nevertheless, I will add now some thoughts about my ingoing migration process: 1. You were right about the importance of making a mirroring field for the Drupal pages id. In fact, I restarted all the migration process from scratch, creating in the PW templates lots of fields to accommodate every kind of value existing in Drupal pages. It turned out to be very useful and I can delete them on PW any time, once the migration process is completed and tested. 2. Migrating multivalued fields is not as straightforward as I would like... It requires some programmatic solution I don't have the skills to implement. Fortunately my site has only a few hundreds of pages and I'm willing to do some kinds of adjustments manually (or, in this particular issue... to give a try with Tracy debugger, via "exploding" an exported line of text from Drupal, containing several values comma separated, and injecting each of them into the corresponding field_pages in PW). 3. My advise to other people facing the same kind of migration: study in-depth the CSS rules in the old site (in my case very flourished and with lots of variants inside the articles) and than try to rethink the CSS rules in the new site using the same naming, otherwise you will end up with a big mess, most of the articles visually destroyed and a lot of work to do by hand. Unfortunately, I didn't do it... On top of that, be prepared to see some CSS formatting (classes and so) magically disappear during the import.csv process (sanitized?). 4. An unexpected problem arose from the combination of stats and pages in different languages. Apparently, Drupal and PW approach the languages issue in different incompatible ways. As far as I understand, Drupal creates different pages (different id) for each language version; PW creates a single page (single id) for any number of language versions on the same page. This results in a major problem, because I'm required to show in the final rendered page the total amount of visits for each page, since its creation. Certainly there would be a smart automated solution for this, but once again it is out of my reach. Plus, I found only 2 modules for counting visits: ProcessPageViewStat and PageHitCounter (simpler and easer to manipulate). But... they are not prepared to deal with languages! And I'm not prepared to transform them into language-aware modules, so this is a problem with no solution at sight. 5. Finally, I gave up manipulating the native "published" field in PW. It is a too messy operation. I opted for creating a new published-date-field - editable by hand, but self-filled with "today date" by default.
  5. Right on the spot, @MoritzLost. Thanks.
  6. My main.php template has <html lang="<?php echo _x('default', 'HTML language code'); ... > and it renders <html lang="default"> instead of <html lang="pt">. As a result, CSS specification {hyphens: auto} will not work. Any ideas how to solve this?
  7. Ok, supposing a template Author, and a template Article with a fieldAuthors (page reference, multiple), the dynamic part of the Author template now goes: $articles = $pages->find("template=article"); foreach($articles as $article) { foreach($article->authors as $author) { if($author->id == $page->id) { // ... some stuff } } } and there it is, the list of articles for that author, next to his/hers pretty face. I imagine it is bad coding, but it works.
  8. Thank you all for your good advises, @dragan , @szabesz , I'm learning a lot thanks to you.
  9. Thanks, @dragan, you were right, of course: the use of a reserved word was a major problem. As for Tracy Debugger , I was already using it (although I think I'm not getting the debug output)[*]. Now the page renders (with my previous code it always crashed without rendering, ). However, even after changing names of the variables, it was not showing the list I intended. It took me half a day of experiments to find out that there is another essential point to put it rendering: // referee pages from Article to Author $articles = $pages->find("template=artigo"); ... foreach($articles as $article) { if ($article->int == $page->id->int) ... ; } ... First: I had to use find() instead of count() to avoid problems. Second: there is some problem/specification with the page reference field I can't get right. Finally I discovered, by random experiment, that I have to declare both the reference and the id of the page as integers (which I don't know how to do it in php, it was a wild guess). Then (finally!) it renders ok. But it is not yet right: Tracy debugger still reports error «PHP Notice: Trying to get property 'int' of non-object ...» Since I can see that several modules (including Tracy Debugger) also have error reports on running, I suppose I should not get anxious about it, since it renders fine. I'm ready now for the next trouble on migrating from Drupal to PW. (*) Side note with absolutely no interest for this case: I can see PW is simpler, cleaner and more elastic than any other cms I came across before. And, as far as I can see, it is perfect for my site needs. Unfortunately, I'm afraid I will never be able to take the most of it. Not because of PW, but because of my personal idiosyncrasy, which makes me unable to learn php, as if there was a concrete wall between me and the language. Two factors intervene: First, the fact that the only programming language I learned and played around a little bit with (apart from Basic, 50 years ago) is Smalltalk/Squeak. After learning ST, php looks like a wild jungle with no sense and a dirty inhuman syntax. I would not complain and it would be much easier for me if I was total virgin in programming, I guess. Secondly ... well, I can imagine that my 68 years old are not helping to learn fast... However, I will insist a little bit more to see if I can migrate my site to PW. It is the most elegant system I ever tried.
  10. I'm building a local test site with PW 3.0.165. Server Wamp, Apache 2.4, php 7.3. I created 2 templates: Articles and Authors. Template Articles has the usual content and images fields, plus: fieldAuthors (page reference to Authors pages, multiple) Both templates render all the fields ok, namely the list of referenced authors in the Article page. In template Authors I tried to make a list of Article pages related to that Author: (sorry for having some words in Portuguese; please read 'author' where 'autor') foreach($pages as $page) { if(count($page->autores)) { foreach ($page->autores as $autor) { if($autor->title == $page->title) $content .= $page->title; } } } It doesn't work. It complains about "PHP Notice: Trying to get property 'autores' of non-object in ...\www\cadppimport\site\templates\autor.php:22" BTW it makes the same complain about the line with if($page->rootParent->hasChildren > 1) { ... renderNavTree($page->rootParent, 3) ... } but in fact it renders right the navTree. What am I doing wrong?
  11. Thanks for your fast answer, @dragan This may be a bad decision (newbie's fate), but after having a look at the links you gave and taking good note of @ryan's comments on date creation/etc, I think I will go for the direct manipulation of the database. My reasons are: 1. In several aspects I want the new site to be an straightforward mirror of the old site (dates, visits, urls, etc.). 2. Creating new fields for dates goes against my opinion on what machines should be and should do. Meaning, if the final user is forced to do the machine's work and to understand the machine's entrails in order to use it, having to put there every single detail the machine should be aware of right from the beginning, we'd be better off. The user should be able to focus in only one thing: conceiving and organizing contents. For my experience, if I complicate the editing page with a plethora of fields, the users will run away and in the end I will find myself forced to edit for them, in order to keep the site growing. Now, let me take a deep breath and get the courage to make some silly questions about the proceeding: I suppose I need to put the sql query somewhere, to run once, but... Where? Is it in the template.php? Should I write a codePiece.php and put an include_once call in the template.php? (and than get rid of it). And if so, does the codePiece.php need some kind of flag or does php take good care of running only once? Please be indulgent, it is the first time I'm dealing with php, and some parts of the php manual are good for those already with some enlightenment, not for total newbies. Anyway, I'll have to find the (long) time to experiment with all this, it won't be for today. As soon as I can do it, I'll tell you about the results. Thanks again for your patience and goodwill.
  12. Thanks @dragan Sorry for asking in the first place. I realize now that there is already a lot of talking about the subject. The fact that my English is very limited doesn't help on using the right words in searches... The programmatic solution looks frightening to me, for the moment. I'll try the module solution; or, to avoid future problems with outdated modules, I'll create a date field in the PW template, since it is easy to export a date field from Drupal via csv. I can't see what means but I guess I'll get there as I put my hands at work.
  13. I'm trying to migrate a Drupal site to PW, using the export/import csv strategy. Not an easy task at all, considering I'm a total ignorant about php and PW. Lots of problems, as expected. Here's one I can't figure out how to solve. I can give up with a few things present in the Drupal site (namely the forum), but for historical reasons it is very important to keep the date published for each page, the author and the visits count. So, first problem: how to change the publishing date when editing a page? I can't find an item for that in the page editor. Is it there and I simply missed it? Thanks in advance for any clue.
  • Create New...