Jump to content

Dave Damage

Members
  • Posts

    25
  • Joined

  • Last visited

Posts posted by Dave Damage

  1. Threaded views can be quite simply done by recursive functions, as you can see in the renderNav function that's part of the default installation profile in pw. If that's not sufficient than you've only the option to copy the whole module or ask ryan to add the necessary hooks.

    Thank you very much, I will give the recursive functions a try, should be sufficient...

  2. Hi folks,

    I need to alter the markup of renderItems of Comments but keep all the rest. So my question is: Do I have to copy the whole folder of wire/modules/Fieldtype/FieldtypeComments and rename it to a new module? Or is there a simpler method?

    Initially I thought about using a Replacement Hook but neither $comments->render nor $comments->renderitem() are hookable according to cpatain hook. And generating custom output would be my last choise since the comments have to be both voteable and threaded. 

  3. The main reason for icon-fonts is that they are much easier to use than svg. On the other hand, the moment one understands the flexibility and power of svg, svg becomes the primary choice. 

    In most projects I use a combination of both. If the customer is happy with the default style that fontawesome or icomoon provides (and most customers are), I use fonts, because I'm lazy. If the customer wants something more unique, I rely on svg. 

    I don't know if it's a german phenomenon but many customers also demand that the site is working with IE8 and then icon fonts become an alternative. 

    Mike Anthony, on 11 Feb 2015 - 05:34 AM, said:

    I find that SVG renders better, at least on Windows. I just haven't seen what the file-size difference is between an icon-font, and a set of bundled SVG fonts for that same icon-font.

    In most cases icon-fonts are much bigger, you have to provide four (or five) different font-types, which is grotesque when you compare it to a set of svg icons. 

    • Like 1
  4. Two thumbs way up for anything SVG :)

    Started using it on the web in 2004 (for server generated vector downloads) - it's been a long wait, but it's awesome to finally see it supported in all browsers!

    I really like svg not only because they are scaleable but they allow me to interact relative easily with them. For example I'm currently working at the mess of my CV (which we call in Germany "Zickzack-Lebenslauf") and so I aim to built some scattered items connect them with lines and when you hover you get the relevant data.

    SVG really rocks (nearly as much as Icon-Fonts) and I hope someday it will become common sense to use them.

    • Like 1
  5. My thoughts exactly, so I thought it would be a good idea to let .htacess rewrite any url with "/?p=$wp-id" to "/rewrite/$wp-id". I had planned to insert into the Page Path History-Database "/rewrite/$wp-id" and the corresponding "processwire-pageid" in the hope that the module could handle that URL format.

    Since I expect an overhaul on many posts in processwire, especially regarding the Page-Names and thus the Page-Urls, it would be interesting if and how the "Redirects"-Module or the new "Advance Redirects/Jumplinks" work with "Page Path History". But I will have definitely a look into both Modules and playing around. 

    Due to the bilingual nature of the Wordpress and the used Language Module (q-translate *grmblxfix*), I was unable to use the MigratorWordpress-Module, because the Language Module only allowed exporting into one language. Using https://processwire.com/talk/topic/3987-cmscritic-development-case-study/ , I wrote my own module (which proved to be quite cool, since I learned a lot about Processwire) and like I said, everything works as it should. (But I'm still quite unsure about best practices, though)...

    For the Wordpress-Urls, I simply extracted them from the database, used Regular Expressions to clean them up a little (removed the Toplevel Domain, so that only "/?p=$wp_id" remained) and during the page creation process, I inserted them via MySQL into the Page History Module Database.

    protected function updateGUID($id, $guid)
        {
            $current = time();
            $db = $this->dbConnector('dbuser', 'dbpasswd', 'localhost', 'database_name');
            $sql = "INSERT INTO page_path_history (path, pages_id, created) VALUES(:path, :pages_id, :created)";
            $query = $db->prepare($sql);
            $query->bindParam(':path', $guid);
            $query->bindParam(':pages_id', $id);
            $query->bindParam(':created', $current);
            $query->execute();
        }
    

    Another thing that still bugs me, that although $current has the correct timestamp, any insert into the database results in a timestamp of (0000-00-00 00:00:00) but if I leave the field blank, the $query won't execute...

    • Like 2
  6. Hi folks,

    I'm in the final stage of importing a Wordpress Blog to processwire, and everything works just fine but the URL Redirects. 

    I have installed the »Page Path History«-Module and during the import I insert the old Wordpress Path along with the new Post ID into the Module's Database.

    But when I try to access the page via "http://example.com/?p=13" it does not redirect me to the actual post but the Home-Page of my processwire installation. Figuring it has something to do with processwire's own Rewrite Rules in the .htaccess, I then had the idea to convert "/?p=13" to "/redirect/13/" and let the Page Path History -Module the rest. So in my .htaccess I created the RewriteRule:

    RewriteRule \?p=([0-9]+)$ /rewrite/$1 [L,R=301]
    

    But somehow this did not work, and every time I try to access "http://example.com/?p=13", I'm still being redirected to the Home-Page. So maybe one of you has some experience to handle such a problem or could point me in the right direction.

    Thanks in advance...

  7. Hi Dave,

    I'm having the same problem - trying to set the page name in another language, and setting it to "active". I looked at the page you pointed to in your [Edit], above, but I'm only seeing a way to read those values... Would you mind sharing what worked for you?

    Thanks!

    $page->set("status$de",1);
    

    Sets the status for the $language (in my case $de).

    $page->set("name$de", $this->sanitizer->pageName($pageName_de, [true]));
    

    With "name$language" (in my case again $de) you set the Pagename in the Language.

    I don't know if its best practice to set the default language (in my case $en) with:

    $page->name = $this->sanitizer->pageName($pageName, [true]); 

    or

    $page->set("name$en", $this->sanitizer->pageName($pageName_en, [true])); 

    I went with the first option, and did not try the second one. Depending on the language, I highly recommend setting up a small script, that converts language-related mutations ( you english people really call Umlaute 'mutations'?) to more machine-readable characters ("oe" for "ö").

    PS: I really like the way processwire handles languages compared to other systems (I'm looking at you, WP!). 

    [Edit]: Somehow I posted the wrong link above and I am unable to retrieve the working one.

  8. Hey Soma,

    thank you for your quick response. Somehow turning off outputformatting did not work: The title is set whether it is turned on or off, but everytime I try to set the localName oer localURL (http://processwire.com/api/multi-language-support/multi-language-urls/) of the page, it throws the same error. 

    $page->localName->setLanguageValue($en, $category['name']);
    

    Furthermore, I seem unable to find how to set the "active"-Status of the URL in the API...

    [Edit:] Nevermind, I found the solution here: http://processwire.com/api/multi-language-support/multi-language-urls/

  9. Hello folks,

    I am currently working at a project where I have to import a Wordpress-Site to Processwire. I have a bunch of multilingual Pages and would like to import them to Processwire. Everything works fine but as soon as I try to set the Page-Url, Processwire throws the error: "Error: Call to a member function setLanguageValue() on a non-object".

    $page = new Page();
            if($category['parent'])
            {
                $parent = $this->sanitizer->pageName($category['parent'], true);
                $page->parent =  wire('pages')->get('/articles/'.$parent.'/');
            }
            else
            {
                $page->parent = wire('pages')->get('/articles/');
            }
            $page->template = 'category';
            $deName = $this->sanitizeUmlaut($category['de']);
            $en = $this->languages->get("default");
            $de = $this->languages->get("german");
            $page->name = $this->sanitizer->pageName($category['name'], true);
            $page->title->setLanguageValue($en, $category['name']);
            $page->title->setLanguageValue($de, $deName, true);
    
            $page->save();
            $page->url->setLanguageValue($en, $category['name']);
            $page->url->setLanguageValue($de, $deName, true);
    
            $page->wp_id = $category['id'];
    
            $page->save();
            $this->message('Successfully imported '.$category['name']);
    

    Has anyone an idea on how to solve this problem?

  10. Thank you for your answers.

    During the last week I discovered the use of Page Tables and use them in 99.99% of all cases, having dropped Repeaters almost alltogether. The only thing that still bugs me is that that the page structure is sometimes a little bit unorganised, especially if I use numerous Page Tables in one page.  But I am working on that problem right now...

  11. Hi,

    I'm a bloody noob to processwire and while I was fooling around, I stumbled upon something, I really can't get my head around: I have a Page Input Field in a template to use it as a Select Field in the backend. I have created hidden pages associated with the field. I would like to assign (or relate or link, I don't know the correct term, sorry) a Integer field to this Page Input Field.

    As an old RPG'ler, I will try to explain it with this example:

    I have a template called »Character« with several fields, one of this field is a Page Input Field called »Classes« with the subpages »Barbarian«, »Bard«, »Cleric«, and so on, then there is a Integer field called »Level«. So when I create a character, I would choose one or more of these classes and assign a level to each of them.

    I know I could simply create subpages with "Barbarian Lvl 1", "Barbarian Lvl 2", "Barbarian Lvl 3" and so on, but I can imagine that there is a much quicker and smarter way.

    Futhermore is it possible to make Page Input Fields dependable upon each other? I would like to choose a option and then in another Input Field select one of this page's subpages:

    Thank you much in advance and sorry for my broken english. 

×
×
  • Create New...