Jump to content

ottogal

Members
  • Posts

    328
  • Joined

Everything posted by ottogal

  1. Hi all, distracted for a while by other (bigger) problems, I now came back to the situation discussed here in this thread in october: For my Hanna Code call [[mp3 audio='LINK']] now I have this Hanna Code (mp3.php): (and all works fine - ) <?php $a = new SimpleXMLElement($audio); $pagelink = $a['href']->__toString(); $pagename = basename($pagelink); $ap = $pages->get("template=audio,parent=audiopool,name=$pagename"); $link = $ap->mp3->url; ?> <div class='block'> <audio controls width='400'> <source src='<?= $link ?>' type='audio/mp3'> </audio> </div> <p><?= $pagename ?></p> But when I open the Hanna Code in the editor and click the button "Save & Test", I get the following messages: The line number refers to the file ....../site/assets/cache/HannaCode/mp3.php where the line and a blank line are prepended - so the line in question is, of course: What is wrong with the code, and how can I get rid of these Warnings? Thankful for some clarification: ottogal
  2. I would like to join, but only beyond 9th of january.
  3. ottogal

    NexWafe

    Great! That for sure is a candidate for the Site of the Week...
  4. BTW: Shouldn't that be $pages->find( So that naming is rather misleading. A proposal (written just here, not tested): foreach ($categ_team as $categ) { $content .= "<h2><a href='{$categ->url}'>{$categ->title}</a></h2>"; $cat_members = $page->find("template=member, featured=0, categ_team=$categ"); $years_start = array[]; foreach ($cat_members as $cm){ $years_start[] = $cm->date_begin; }; $years_start = $years_start->unique(); foreach ($years_start as $y){ $content .= "<h3>{$y}</h3>"; //or apply some formatting to the $y value $members = $cat_members->find("date_begin={$y->date_begin}"); foreach($members as $m) { $content .= "<h4><a href='{$m->url}'>{$m->title}</a></h4>"; } } } Edit: Small correction.
  5. I'm guessing: The 2013 sub-list is showing up twice, because there are 2 members having this date_begin - and if you had 3 of them, it would show up three times...? $years = $page->find("template=member, categ_team=$categ"); I think this PageArray will contain each year several times - one for each member having the same date_begin. You could try $years = $page->find("template=member, categ_team=$categ")->unique();
  6. Hi all, the renowned German magazine for computer tech, c't, in its most recent issue #25/2016 is presenting several "WorldPress alternatives", and ProcessWire is among them. (My translation.)
  7. Since you use 'item_tpl' => '<a class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false" aria-controls="navbar" href="{url}">{title}</a>', these classes of course will be added to all the <a> elements, independent of the <li> having has_children or not. The point is that the class has_children is an optional class for the <li>, not for the <a>. So a workaround could be changing the CSS. Assuming your class dropdown-toggle is defined like this: a.dropdown-toggle { /* your styles here */ } Then change this to li.has_children > a { /* your styles here */ } So your styles are applied just to those <a> elements which are direct children of a <li> element having the has_children_class. (Didn't try it, just written here...) A quite different (and way more complicated) approach would be the use of the "hook for custom item string (new in 1.2.0)" - see the README of http://modules.processwire.com/modules/markup-simple-navigation/
  8. Thanks to both of you for the clarification. I'll give it a try.
  9. Great idea. Just a thought: Couldn't it be overkill to pass the whole $page object to the function (in case it has a lot of properties&methods, and the file to render needs just a few of them)?
  10. Why didn't you try what Robin S proposed above:
  11. I'm observing this behaviour every now and then, with different AsmSelect fields (not in a repeater). But it doesn't seem reproducible, it's a randomly ocurring phenomenon. I assume it's a problem of Firefox, not PW.
  12. "subfiles" here means partials to be included? And even more? Hanna code?
  13. @Robin S Good find, thank you! After this change even my simple use of the function strstr() works - to crop the string on both ends, setting free the href attribute value: <?php $f = (string) $file; $f = strstr($f,'/site'); $audiofile = strstr($f,'">',true); ?> <audio controls> <source src='<?= $audiofile?>' type='audio/mp3'> </audio> Your second hint to use SimpleXMLElement() of course is a cleaner way to do it: <?php $a = new SimpleXMLElement($file); $audiofile = $a['href']->__toString(); ?> <audio controls> <source src='<?= $audiofile?>' type='audio/mp3'> </audio> Didn't know this class before - so again I learnt something new. Thanks a lot again!
  14. Hi all, I'm struggling with a problem which is more a PHP issue than one of Hanna Code. <?php ?> <audio controls> <source src='<?= $audiofile?>' type='audio/mp3'> </audio> This little HC works fine when used in a textarea/CKEditor field like this: [[audio file="/site/assets/files/1234/foo.mp3"]] Now I wanted to make it flexible and enable the editor user to insert the path to any mp3 file (stored on some page in a field "mp3" of type File, allowed file extension mp3). In the HC Attributes I set a default value for $file, defining file=LINK . Now the editor, inserting the HC using the HannaCodeHelper Module, gets [[audio file="LINK"]] The aimed workflow for the editor user was: Double click on LINK to mark it and using the Link button of the CKEditor to choose the wanted file from the wanted page. Obviously, the value created by CKE had to undergo some treatment. Of course it's a link from which I had to extract the value of the href attribute (here /site/assets/files/1122/bar.mp3) , but because of the double quotes from [[audio file="LINK"]] it would become "<a href="/site/assets/files/1234/foo.mp3">" where the second " would terminate the string. I tried string functions str_replace(), strstr() etc. but to no avail. Perhaps I could have used Javascript, but I wanted to find a PHP solution. Could anyone help on that?
  15. Hi all, to open a certain page for editing you can use $session->redirect($mypage->editURL); But what when you would like to open the Children tab of that page instead? Just change it to $session->redirect($mypage->editURL . '#ProcessPageEditChildren'); I found it hovering over that tab: The status line shows the additional "#ProcessPageEditChildren". Perhaps this could be useful for some of you...
  16. Shouldn't you choose a more telling title for the homepage? Somebody might bookmark it and would find just "Home"... Edit:
  17. Do you really need to unpublish the page? Why not just hide it?
  18. Thanks monchu, but it's not even needed: At a new start of PW obviously the file /site/assets/logs/errors.txt is restored automatically.
  19. That's it (of course!)... (Although I'm quite sure to have tried type File too.) Thank you, BitPoet, for your time.
  20. Erraneously I burnt the errors log under Setup>Logs - I wanted to clear it, but erased it permanently instead. How do I get it back?
  21. The filepage already exists. I used the code from Nico nearly literally. The explanation there is a bit short; so I'm not sure what Field Type the field should be. I tried URL or simple text for the filename, but these wouldn't give an object. Could it be Page Table? A Page Array - since a foreach is mentioned? A more detailed example would be helpful.
  22. Hi all, to upload a huge file I'm trying the workaround presented by Nico in his Troubleshooting Guide at the end of page 4. Running /tmp/uploadhelper.php I get the message Error: Call to a member function add() on a non-object (line 7 of ....../tmp/uploadhelper.php) where line 7 is $filepage->fieldname->add($config->paths->root.'tmp/hugefile.zip'); Of course fieldname is the name of a field I added to the template of the $filepage defined before. I tried to replace $filepage->fieldname with $filepage->get("fieldname"), to no avail. What do I have to do to change this into an object? Thankful for any hint...
  23. Since in my case there is only one pagetable field, I don't think that it matters that you have two of them. Strange enough, I think I had this issue a while ago and found a workaround - but don't remember what I did...
  24. I can confirm jüergen's observation (PW 3.0.35, but had it already in earlier versions). No second page table field present.
  25. This curly brackets syntax doesn't work in PW 3.0.24 (and not in the config settings for the PageList module).
×
×
  • Create New...