Adam Kiss
Moderators-
Posts
1,303 -
Joined
-
Days Won
7
Everything posted by Adam Kiss
-
Hey Nico, there is CSV import available somewhere here on forums (ha!: https://github.com/ryancramerdesign/ImportPagesCSV ), which will allow you to import pages from CSV – the only problem now would be to export your typo3 site (or WP site) to CSV. Also, I previously transferred site from WP to PW, which was done via little hack in 'The Loop' in WP and simple_xml import on PW side (where it was breeze, thanks to PW API – I just populated correct fields, hit save and it was done) It really depends on how complicated are your typo3/WP sites (I couldn't use WP Export tool, for instance, because it was useless due to some of the plugins used)
-
Not to brag, but you seem to switch from arguments, where ',' is needed (limit, cats, id) to arguments, where it shoudln't be... do you really want it that way? Other than that, I would try putting the sort as last item in the call, or switch from get()->children() to find(). This might or might not be bug, so we'll see where the error is.
-
In the meantime, this should not be problem to put together as a little module; even if the only thing it did was to list pages with new comments, it seems that would help; I'm not hundred percent sure what the syntax is right now (never worked with comments in PW so far), but it doesn't sound that hard right now;
-
Integrating PW as a backend for codeigniter app
Adam Kiss replied to landitus's topic in General Support
I'm just thinking out loud, but wouldn't the best approach be to create small CI wrapper – probably model (since we're accessing data here, albeit via API), and access wire() throught that model? Something like <?php function __construct(){ $this->pages = wire('pages'); } $this->pw->pages->find('...'); As for white page, I'm 99% sure there's some PHP error along the way; have you checked php_error.log, whether it's not some dumb missing semicolon? -
Simply; You call 'url' property of image object, whether you have the object initialized (i.e. if page has images), or not (the second part, where you should set fallback). If it's the latter, it will fail, because it seems you don't know how to create fallback image You have multiple options here; either create some fallback page (e.g. '/fallback'), which wil have the fallback image prepopulated – in this case, in my previous code, the second part will be: // expand '$newsthumb' with some fallback image? $newsthumb = $pages->get('/fallback')->images->first()->size(80,80); or, more direct approach is to add another variable, e.g. '$newsthumburl', and either populate it if image is found or hardset it to fallback/placeholder image if not: <?php if(count($newsitem->images)) { $newsimage = $newsitem->images->first(); $newsthumburl = $newsimage->size(80,80)->url; }else{ $newsthumburl = '/path/to/my/fallback_image.png'; } echo "<dl ... {$newsthumburl} ... >";
-
I found about this exactly 11 months ago through Ryan's forrst post. Checked it out, emailed Ryan some questions I had regarding this software, and after few brief emails about ahy are we not replying each other in 5 minutes , his first response went like this: There you have it! Friendly from the start Also, I guess it makes me early adopter. Been hanging around PW ever since.
-
Hey! This should work <?php if(count($newsitem->images)) { $newsimage = $newsitem->images->first(); $newsthumb = $newsimage->size(80,80); }else{ // expand '$newsthumb' with some fallback image? } echo "<dl ... >";
-
You can just delete shorter words from query, check whether rebuilt query (without short words) has any length and then search for this: <?php //i assume $query containing search string $query = 'this is one word longg wordd'; $queryArray = explode(' ', $query); array_walk($queryArray, create_function( '$v,$i,&$queryArray', 'if(mb_strlen($v)<=3){unset($queryArray[$i]);}' ), &$queryArray); $query = implode(' ',$queryArray); //now you have shortened search string in your $query, so you can find() with it $result = $pages->find('title|body|search_field~='.$query);
-
This actually might be better to search in TinyMCE support. http://lmgtfy.com/?q=classes+in+tinymce
-
Are you having problems with the loop that splits PageArray and adds header before each starting letter group, or ordering children alphabetically?
-
This could be possible with new pages, less with modified pages – via 'guest account'. Of course, that will make your workflow a little bit harder, but possible: Create page keep it unpublished uncheck guest publish it test it, edit it, test it check guest access and publish it with it done.
-
Hey Gen, welcome to the forums. That is not correct behavior, as far as I can tell. Please, create new topic, state your problem, what you are trying to do, what's your installed version, post some code and we can look into that then. Thanks!
-
Outputting nested contents of page children/grandchildren
Adam Kiss replied to martinluff's topic in API & Templates
@martin and @pete: just a quick explanation: '>' as a character means child element, while only chaining elements with space targets descendant elements. <div> <p.a> <div> <p.b> </div> </div> In this case, div > p will select p.a only, while div p will target p.b as well as p.a. Also, I noticed that my previous example was wrong, since the next-level li will never be direct descendant of the higher level li – there always'll be another ul wrapping the next level li's together. Will edit my post accordingly – it won't be as nice, but still will allow you to write cleaner CSS. -
Outputting nested contents of page children/grandchildren
Adam Kiss replied to martinluff's topic in API & Templates
Just to update Pete's CSS–If you use following CSS: ul#my-ul > li { } ul#my-ul > li > ul > li { } ul#my-ul > li > ul > li > ul > li { } You won't have to create the CSS for the deeper levels overriding the shallower ones -
This often happens if you put space (' ') between query selector ('template') and sign ('='). Check that on your line 123 in grab.php.
-
When I needed something like this (though not dynamically updated, only admin-updated), I create pure text field, without TinyMCE, and written the custom format in CSV there. If you select your character correctly, it's also quite readable, like so: option1 _ 540 _ I think it's very cool! option2 _ 650 _ I'd rather not do it option3 _ 20 _ Absolutely not! And then, I created custom field formatter (this is full code, only stripped of my header comments:). Just now I realized, that outside of the module, you could also add encoding function in static class (so it's globaly available everytime you call this file) <?php /** * Custom Textformatter * * Takes saved textarea and parses it into array of values * * */ class TextformatterCustomFormatter extends Textformatter { public static function getModuleInfo() { return array( 'title' => '-- stripped title--', 'version' => 100, 'summary' => "Parses textarea by new lines – \\n & '_'", ); } public function format(&$str) { if (empty($str)) return; $retArray = array(); $inArray = array(); $inArray = explode ("\n",trim($str)); foreach ($inArray as $i){ $i = explode('_',trim($i)); foreach($i as &$inItem) $inItem = trim($inItem); $returnItem = (object)array ( 'votes'=>intval($i[1]), 'text'=>$i[2] ); $retArray[$i[0]] = $returnItem; } $str = $retArray; } } public class CustomTF { public static function encode($inArray){ $outString = ''; foreach ($inArray as $opt=>&$iA){ $iA = implode (' _ ', array($opt, $iA->votes, $iA->text)); } $outString = implode ("\n", $inArray); return ($outString); } } and now, in your update function, you do this (I assume $answerVoted to have sanitized option ID ['option1' for instance]): <?php $pollOptions = $page->options; $pollOptions[$answerVoted]->votes++; $page->options = CustomTF::encode($pollOptions); $page->save('options');
-
I have teamviewer set up on all of my computers, even the virtual ones
-
PW doesn't solve 'page number out of bounds' situation
Adam Kiss replied to Adam Kiss's topic in API & Templates
This is kind of like twice a year updated alcohol shop [posted in showcase now], so it's ok, I think -
I moved an old client's page from WP to PW, because... Mostly because WP sucks and PW is awesome (translated into business terms: It was cheaper both for me and for client [in terms of money as well as time] to rather move page to PW, than to push WP a little farther again) Site is live here: http://www.acan.sk [only in slovak language, unfortunately] It's about awesome alcohol client sells. As far as custom things go: Modules used: AdminBar, CodeMirror Custom features: on the fly Template->session->PDF generation (just to be mailed to us) custom inputfield formatter contact list (rather simple) in-CMS saving of how many times product pages were viewed on the fly sitemap.xml generation – this one's reusable and as soon as I found out how to share it (blog, forums, forrst), I will do so That's it!
-
PW doesn't solve 'page number out of bounds' situation
Adam Kiss replied to Adam Kiss's topic in API & Templates
Yep Also, I moved to PW from WP right now, and also shuffled categories a little bit – and since I split 6 categories into 12, some redirects go to empty pages now. Not that I care that much, but it got me with surprise – especially with all that auto-magic that happens when we do pagination with PW. -
PW doesn't solve 'page number out of bounds' situation
Adam Kiss replied to Adam Kiss's topic in API & Templates
I understand that, but I think there is difference between url segments and pagination here: Url Segments basically allow you to use url segments, but the only thing you get when turning it on, is access to 'child' URLs, and way to handle them. Whole logic about what to do with this is up to you, and so are any exceptions needed Pagination (or page numbers), on the other hand give you everything automated; you add one limit to your code, and that's it Because of this automation, I believe PW should either solve non-existent page URLs for you, or at least provide some simple method to detect it, something like $paginator->outOfBoundsPage(), or something like that. -
If you have set your template to use page numbers, system automatically accepts any 'page%d' url segment. This however means, that for every number greater then actual page count, empty page is rendered (or else, depending on your html/css). Instead system should either *return information about missing page* to let page administrator handle this, or simply *return 404* and let the system's 404 page inform the user. Or combination of both, so webdesigners can use 404, but handle this situation different way, if they want. Also, github issue was posted here: https://github.com/ryancramerdesign/P21/issues/52
-
Hi Alasdair, I went through multiple PHP PDF generators lately, so let me share my experience and see if it helps; I started with FPDF, because after testing with my workflow few years back, it was the simplest. I had to program un-utf function, because fpdf simply doesn't offer it, but other than that it was perfect. In these days, I needed to reintroduce PDF generation, so I took FPDF and reused. That UTF-8 unfriendliness was unfortunately showstopper for me, so I also went throgh TFPDF and IPDF I believe, both supposedly UTF-8 friendly forks of FPDF. Sadly, this was a no go, and TFPDF even was not very reliable – somehow, generation of numbers didn't work as expected, because some number were randomly not being generated. After fghting with FPDF, TFPDF, and UPDF, I almost went back to tcpdf, which I tried years ago, but I found 'dompdf' – http://code.google.com/p/dompdf/ – which rather works. Its main plus is that the PDF's are generated from normal HTML code, are styled with CSS too (although CSS2.1 only). UTF-8 works without problems. The only downside I noticed so far is that PDF files generated by this are rather big – one A4 document can have up to 1.5MB so far. I believe this is due to me not going deep enough with this system – I used pre-compiled UTF fonts (that's nr. 1) and I also don't limit subset used, which I believe is possible and could help great deal. Also, if my suspicion is right, multiple paged PDFs wouldnt be as big, because if majority of that size is in fonts, any page other than the first would me much smaller addition to final size. Hope this helps, Adam
-
Hey Antti, I checked out the code quickly; You should be able to just position the switching UL against the top & against the title and then add the background & padding to li.InputfieldWrapper. I hope I understood you correctly.
-
Sorry, it was 2 am, and I absolutely made no fucking sense. So, again: There is an option which fields you want to show in page tree (the main admin page tree), as opposed to showing nly title. You can input some titles, and those show up, split by comma and space. Now, I think it would be nice/ridiculous (pick one), if you could not only input which fields you want to show as page name, but also how: Pagetype, /page/, Page Title Ipsum could become /page/ – Page Title Ipsum [Pagetype] for instance.