-
Posts
4,632 -
Joined
-
Last visited
-
Days Won
55
Everything posted by apeisa
-
Ryan has mentioned namespaces few times already, they are definitely on the long term roadmap. But as long as we want to keep PW compatible with php 5.2, then no hope for namespaces. Very interesting that script you mentioned. Have you tried it on current PW codebase?
-
Ryan: I like your plan, sounds much easier approach to start learning and build upon.
-
I guess the encode function wants page object instead of wirearray. Change find to get to see results?
-
How to get admin page with certain Process assigned?
apeisa replied to apeisa's topic in API & Templates
Had to use this in other situation and it works for me. Thanks Ryan! -
Inputfieldmodule doesn't autoload their js/css
apeisa replied to apeisa's topic in Module/Plugin Development
Yeah, maybe it is just inconsistent. I couldn't figure out any reason for that. Now I created new Inputfield and Fieldtype, used them normally (not through autoload) and they load js|css just fine. -
Inputfieldmodule doesn't autoload their js/css
apeisa replied to apeisa's topic in Module/Plugin Development
Btw: reason I am building this (it will be event registration form editor) as a Inputfield instead of Inputfield & Fieldtype combo is that I do need more than one db table to store the values. Should or could I still use fieldtype here? My current plan is to build Inputfield, which is appended to right pages through autoload module - and saving db values will be done in ___processInput method. -
I have this module (InputfieldTapuEditor.module): <?php class InputfieldTapuEditor extends Inputfield { public static function getModuleInfo() { return array( 'title' => 'Inputfield Tapu Editor', 'summary' => 'Lomake-editori ilmoittautumislomakkeiden luontiin ja muokkaamiseen.', 'version' => 001, 'permanent' => true ); } protected $event_id = 0; protected $current_form; public function ready() { } public function ___render() { $this->event_id = $this->input->get('id'); $form = new TapuFormsRender($this->input->get('id')); $this->current_form = $form->returnFormArray(); /* Why are these required?? $this->config->scripts->add($this->config->urls->siteModules . "InputfieldTapuEditor/InputfieldTapuEditor.js"); $this->config->styles->add($this->config->urls->siteModules . "InputfieldTapuEditor/InputfieldTapuEditor.css"); */ $out = "<div class='header'>Lataa mallipohja | Aloita uusi lomake | Tallenna pohja malliksi</div>"; $out .= "<ul id='valinnat'>"; foreach($this->current_form as $field) { if (strlen($field['custom_id']) > 0) $id = $field['custom_id']; else $id = $field['id']; $attrs = array( 'selected' => 'selected' ); $select->addOption($id, $field['nimi'], $attrs); $out .= "<li class='tyyppi-". $field['tyyppi'] ."' data-id='$id'><a href=''><span class='ui-icon ui-icon-gear'></span>" . $field['nimi'] . "</a></li>"; } $out .= "</ul>"; $out .= "<br><br><br><pre>"; $out .= print_r($this->current_form, true); $out .= print_r($this->saatavillaKiinteat, true); $out .= print_r($this->kaytetytKiinteat, true); $out .= "Tää on editori</pre>"; return $out; } } For some reason it doesn't load automatically the .css and .js files, called InputfieldTapuEditor.css|js It might be because of the way that is initialized, it get's put into page editor through autoload module: <?php class TapuEventForm extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Tapu Event Form', 'summary' => 'Lisää tapahtumasivun muokkausnäkymään "ilmoittautumislomake" välilehden', 'version' => 001, 'permanent' => false, 'autoload' => true, 'singular' => true ); } public function init() { } public function ready() { $page = wire('page'); if ($page->template->name != "admin") return; $id = $this->input->get->id; $page = wire('pages')->get($id); if ($page->id) { if ($page->template->name != "events-item") return; } else { return; } $this->addHookAfter('ProcessPageEdit::buildForm', $this, 'addFormTab'); } public function addFormTab($event) { $this->config->styles->add($this->config->urls->siteModules . "Tapu/Tapu.css"); $id = $this->input->get->id; $wrapper = $event->return; $formTab = new InputfieldWrapper(); $formTab->attr('id', $this->className() . 'View'); $formTab->attr('title', $this->_('Ilmoittautumislomake')); $editor = new InputfieldTapuEditor(); $editor->label = $this->_("Ilmoittautumislomake"); $editor->attr('id', 'tapuEditor'); $formTab->append($editor); $wrapper->append($formTab); $event->return = $wrapper; } public function install() { } public function uninstall() { } } Is the autoload module reason for not to load the .css and js? Also: I am planning to use other Inputfield modules inside my InputfieldTapuEditor.module. Is that possible? They seem to render fine, but same problem there: no js or css loaded. Or rather: if I try to render AsmSelect field there, it gives me just a plain multiselect (I guess that is how it should work if js isn't available).
-
For some reason this module doesn't parse this RSS: http://www.ttl.fi/fi/tiedotteet/Sivut/Rss.aspx W3 validator says it is fine (although a lot of recommendations offered): http://validator.w3.org/appc/check.cgi?url=http%3A%2F%2Fwww.ttl.fi%2Ffi%2Ftiedotteet%2FSivut%2FRss.aspx Not sure what goes wrong and where..?
-
Not sure if Ryan dropped that option. You should get timestamp by setting $page->of(false) before outputting the date field. Then turn it back to true right after.
-
Yep, the new datefield is on the core already.
-
Not sure if this works, but let's assume your repeater field is called "repeater": function listPageFields($page) { echo "<h1>{$page->title}:</h1>"; echo $page->renderFields(); foreach($page->repeater as $p) { echo $p->renderFields(); } if($page->numChildren) { foreach($page->children as $child) listPageFields($child); } } listPageFields($pages->get('/'));
-
Very nice job Ryan! I like it a lot! Few notices: Maybe add real sidemenu for normal pages (I love the categories main page!)? Currently subpages available only through drop down, which will cause some accessibility challenges. Edit this page -link on sidemenu doesn't work Error Call to a member function findPosts() on a non-object (line 13 of /srv/www/pw/pwblog/site/templates/widget-recent-posts.php) when I try to view widget directly. public function headline($text) { return "<h1>$text</h2>"; } Few ideas: I don't like the way image gallery is embedded. a) It's in english B) it is easy to make mistakes. Maybe use checkbox instead? Of course we lose some flexibility that way.. but this is more of an issue how deeply integrate tinymce or to build something better to replace it... It would be great to have comments editable directly on post view! About the intended audience: There are quite a lot of markupClasses and stuff like that, which look like interesting and will definitely help maintaining the code. But for beginner they might look & feel a little bit scary and definitely makes this harder to grasp than demo profile. I think part of the "easiness" of Wordpress and the like is their "messiness" and how straightforward they are. Currently if you just open the "post.php" file you cannot directly there say how to edit the post view (say to change <h2> to <h1> from post title). You need to open /blog/init.php next. There you definitely cannot say where the code comes. Next you might open the BlogOutput.php.. no luck. Then maybe BlogMarkup.php.. this might be it, but you don't find any easy big bunch of html from there either... I am not totally sure if I understand the intended audience right though: if this is example how flexible PW is as a framework and how to build a blog-software using it (and of course at the same time provide a great blog software using it) then this is brilliant way to go and I would keep pushing it in current direction. But if this is intended as a starting point for any web developer to install and build upon.. then I think some approach between this blog and current default site might be best way to go. I don't want to sound nagging, but wanted to share my honest feedback. And after playing with this a little more I probably have totally different opinions This is very polished and great work Ryan! Eager to see much more pw-powered blogs out there!
-
How to get admin page with certain Process assigned?
apeisa replied to apeisa's topic in API & Templates
I haven't yet tested this, ended up using different method. Will test this soon. -
Very well said Ryan, couldn't agree more. While I know I wouldn't use template language, I think that might well make PW a little bit more beginner friendly. Not sure if it is worth the trouble (vs. writing more tutorials, getting started materials etc..). Also maybe we could cheat a little here, and tell that PW uses templating language called "Wire", which looks like this: Output a variable: <?= $page->title ?> Loop for children: <? foreach ($page->children as $p): ?> <h2><?= $p->title ?> <? endforeach; ?>
- 74 replies
-
- 6
-
-
- template engine
- twig
-
(and 8 more)
Tagged with:
-
Syntax is easy in both. What I meant that if you make error in php it kills the page. That is pretty extreme for live editing fellow who is just starting.
- 74 replies
-
- template engine
- twig
-
(and 8 more)
Tagged with:
-
I have feeling that I have asked (or at least read) answer to this one before, but couldn't find the answer anywhere. I have tried this kind of stuff without any luck: $invoice = $this->modules->get('ProcessInvoice'); $invoicePage = $this->pages->get("template=admin, process=$invoice"); // OR $invoicePage = $this->pages->get("template=admin, process={$invoice->name}");
-
Ryan, this might be helpful topic: http://stackoverflow.com/questions/3221771/how-do-you-get-php-symlinks-and-file-to-work-together-nicely It would be great to run many modules as symlinks, makes maintaining so much easier.
-
I don't think PW uses short tags internally, so using those is purely optional. I might be wrong here though...
- 74 replies
-
- template engine
- twig
-
(and 8 more)
Tagged with:
-
Nate, welcome to the forums and thanks for the suggestion. It is something that pops up every now and then and certainly something to think about. I think only thing that makes template languages more newbie friendly is that those fail silently. Forgot ending ?> from <?php and whole site won't load. This single thing might be big obstacle for someone who is just starting. What comes to echoing variables and making simple if statements or foreach loops - I don't think that any template language is much easier than PHP. I have only used EE tags, Smarty and tried Laravel's Blade, so I don't know too much of those.
- 74 replies
-
- 2
-
-
- template engine
- twig
-
(and 8 more)
Tagged with:
-
Some kind of clever truncateDescription method for strings would be nice to have in core. Most of that kind of needs are pretty well available on php, but cutting text is something that needs some logic to work well. EDIT: This seems to be on core already, but maybe not in logical place: https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Markup/MarkupRSS.module#L169
-
Wouldn't it be better to build email fieldtype? Or do you have fields where value might be url or email?
-
This looks great! I need to start thinking about building a tiny shop profile. One note though: while browsing with android phone, the site feels little slow. I would guess it is the use of those CSS gradients on big post elements.
-
What about using repeaters, where one field is "fall down"? It doesn't sound too difficult concept to me. Then there might be other selection to put it "up" or "down" of other blocks there might be on deeper pages. Our old cms supports similar feature, although the configuring part of which blocks are "falling down" is done by site builders.
-
Change the language for the guest user.
-
Is there any way to sort file/image field content?
apeisa replied to Robert Zelník's topic in API & Templates
Isn't the default sort oldest first? Then you should get newest first just reversing the order (of course assuming you haven't changed the order): $images = $page->images->reverse(); Other WireArray methods: http://processwire.com/api/arrays/