Jump to content

pppws

Members
  • Posts

    46
  • Joined

  • Last visited

Everything posted by pppws

  1. Hi there, I created a files field which is already populated with images and videos. this field functions as the data for a slideshow. which works fine. but i need to resize the images, which does not work because the files field doesn't allows the ->size command. Is there any way to seperate the images in the files field in order to resize them? edit: i already tried to create a new pageimage: $image = new Pageimage($page->images, $slide->filename); which results in an error: Aw shucks… Fatal Error: Uncaught TypeError: Pageimage::__construct(): Argument #1 ($pagefiles) must be of type Pagefiles, null given, called in <u>site/templates/basic-page.php</u> on line 19 and defined in <u>wire/core/Pageimage.php</u>:162 Thanks alot! Philipp
  2. Ahh… no… i just fucked up the order of code… it was too late... hahah. thanks guys!
  3. hey there, i'm pretty sure it's a dumb question, but im getting console errors for unexpected tokens: < var cal = $( '#calendar' ).calendario({ displayWeekAbbr : true, caldata : { <?= getEvents(); ?> // this is our function to grab our events } });
  4. hey there, i migrated my local website to the liveserver and the frontend is running just fine. however i get some errors in the backend which make the site unusable: when trying to access some of the templates i get the following error: Error: Cannot access self:: when no class scope is active (line 96 of /hermes/bosnacweb02/bosnacweb02ad/b1909/dom.hexiangyucom/2018/site/modules/ProcessSetupPageName/ProcessSetupPageName.module) This error message was shown because: you are logged in as a Superuser. Error has been logged. when creating new pages or saving older pages(with the same template) i get the following error: Error: Using $this when not in object context (line 90 of /hermes/bosnacweb02/bosnacweb02ad/b1909/dom.hexiangyucom/2018/site/modules/ProcessSetupPageName/ProcessSetupPageName.module) This error message was shown because: you are logged in as a Superuser. Error has been logged. so i'm guessing somehow my template(s) are broken, but locally they run fine – how do i fix this error :/? thanks in advance! edit: i just moved the installation to another server –– and it's working fine. any idea why it isn't working on the first server? edit2: php version caused the problem.
  5. Hey there, for a current project i'm using the 'PageTable' Module, which works great! I created several 'modules' (PageTables) that the user can choose from. I also allow the user to set a 'checkbox' to display an excerpt of the page on the homepage. Now it gets a bit tricky: when a page contains an 'event'-module, the event module gets also displayed on the frontpage. which also still works. my problem is that the ->url (obviously) returns the url to the page used by the PageTable field and not by the 'parent'-page. for better understanding: // get all pages (modules) with template 'event' $featured = $pages->find('template=Veranstaltung, sort=-module_event_datestart, module_event_dateend>=today'); // get all pages marked with frontpage $featured->add($pages->find('frontpage_show=1, sort=created')); i loop through all the posts with some if statements e.g. for 'events' <?php if ($child->template == "Veranstaltung"): ?> <div class="article__event"> <?= $child->module_event_text ?> <a class="article__readmore" href="<?= $child->url ?>">read more</a> </div> <?php endif; ?> All pages created by the PageTable module are stored in a page called 'never touch', so the $child->url returns something like: 'never-touch/never-touch-2018-2054/' What i need is the url of the 'real' parent page. so if the event is created as a module of the page 'Exhibitions' i need to return the url of the 'Exhibitions' page and not of the PageTable page ('never-touch). thanks for any tips! philipp
  6. Hey there, i've set up a page wich uses pageTable and it works like a charm. for my home page i get several pages. they are sperated in two types: a) page has the module 'featured_img' b) page doesn't have the 'featured_img' my pageTable field is called add_modules. so i was wondering if something like <?php foreach ($featured as $child): ?> <?php if ($child->add_modules->module_featuredimg): ?> // show image <?php else: ?> // show text <?php endif; ?> <?php endforeach; ?> is possible? thanks for your input!
  7. hey, maybe a super dumb question and i bet there is a super easy solution to this, but i can't find it and obviously i'm too stupid to google the right words… but how can i change the date format for from '4 weeks ago' to the acutal date? ('first saved by user' is a field created by me, so i can change it for this field). thanks for any help!
  8. no, i want all of the repeaters sorted by month. not only their parent pages. the screenshot shows all pages wich include a repeater field with the year 1969. the names are the names of the pages. the second number is the month (1 = january, 4 = april and so on) but i don't need the pages to be sorted, but the repeater fields. so the list should be: julio, 1 selva, 4 gloria, 5 gloria, 5 gloria, 6 miguel, 6 sandra, 7 catalina, 8 luis, 10 hilda, 11
  9. this actually changes the order, but not in the way i need it.
  10. hey there, i have the following structure for a repeater field: moments, 10x per page (unfortunatly a lot of pages, roughly 400) -- yearofmoment -- monthofmoment -- textofmoment i'm trying to find all repeater fields of certain year and sort them by month. e.g. get all repeater fields of year 1969, first repeater to be displayed: repeaters with monthofmoment = january. i already got this: <?php $langname = "es"; //temp: only get spanish profiles?> <?php $persons = $pages->find("template=persons, lang=$langname, moments.yearofmoment=1969") ?> <?php foreach ($persons as $p): ?> <?php foreach ($p->moments as $moments): ?> <?php if ($moments->yearofmoment == 1969): ?> <ul> <li><?= $p->givenname ?>,<?= $moments->month ?> <?= $moments->yearofmoment ?></li> </ul> <?php endif; ?> <?php endforeach; ?> <?php endforeach; ?> but somehow i can't figure out how to sort the repeater fields by month. the code above gives me this result: (julio should be on top, luis the last )
  11. ohhhh! somehow i missed the notifications for your answer! but it works! thanks a lot! whooooo.
  12. hey there, i have a form to create repeater fields on the frontend via the api, which works fine. if(count($newMoments)) { $page->moments->removeAll(); $page->moments->add($newMoments); $page->save("moments"); //$page->moments->sort('yearofmoment, month'); //$page->save("moments"); //echo "saved professions"; } but now i'm trying to autosort them when/before (?) saving the page. on top you see one of the attempty i've tried to get this done. by now i know that i have to put the sort function outside the if() because sometimes there will be no now moments, just editing of the existing ones which could cause a new sorting as well. so i put it here right under the if(). which causes the 'moments' to be sorted after submitting the form. but after a reload the the moments get back to the order in which they were entered. and in the backend nothing changes at all. what am i doing wrong? do i have to use a usort() function to sort the $newMoments php array? thanks for any help!
  13. hey there, i know it's a kind of dumb question, but… is it possible to duplicate the "name" field in the backend and output the whole page URL in the input? i know that i can copy the link when right clicking on it, but just a input field with the whole URL would be more comfortable (in this case). the second field (ES) illustrates what i mean. thanks for any help!
  14. hey there, i'm creating new pages via a form – which works great. to prevent the same pages names i try to validate the inputfield for duplicate entries. in the form i ask for the users e-mail address which becomes the title for the page. i modified the given example (don't allow hotmail e-mails) to this: // here is a good point for extra/custom validation and manipulate fields $email = $form->get("email"); // check if e-mail already exists if($pages->count("email=$email, include=all") > 0){ // attach an error to the field // and it will get displayed along the field $email->error("E-Mail is already in use."); } the form still gets processed and returns a php error: which i'm trying to avoid by checken for duplicates upfront. when i'm using $page->count("email=$email, include=all") > 0 on a test template it returns the right value.
  15. because the admin should be able to change the status in the backendend too – and it's more comfortable to handle this with a select field. do you think my $page->progress_status = $page->progress_status->id +1; solution will cause any trouble?
  16. hm. nah. it's not working :/. when i try: $newstatus = $page->progress_status + 1; this error is returned it works with: $page->progress_status->id
  17. okay, i try to be more precise the form is on the frontend. the user can fill out several fields and save them to the page he's editing (still on the frontend). each time the user hits the save/submit button i want to change add 1 to the status. the states are something like this: 1 – created 2 – saved once 3 – saved twice 4 – saved thrid time etc. as mentioned above i already know how to fill the field via inputs fields. but right know i'm struggling to add 1 to the status. my status field is called: progress_status. when i'v alread tried the things below, but the fail due to array errors or some other errors i can't figure out: $status = $page->progress_status; $newstatus = $status++; foreach ($status as $stat) { $newstatus = $stat+1; } foreach ($status as $stat) { $newstatus = $status[$stat]++; }
  18. do hooks work for page editing on the frontend via the api? i want to change the status (value of the selectfield) when submitting a form.
  19. hey there, i have a selectfield with 9 options. each options represents a status. when a user hits a button on the frontend i want to add +1 to the current status. e.g. the current status is 4. the user hits the save button, i want to resave the page with the new status of 5. i know how to save the page. the problem is to update the status itself. i can't figure out how to convert the select option (in my case. $status = $page->progress_status; ) into an integer value to add +1.
  20. i'm reloading the page by hitting enter in the url bar again, not f5 – i think that should prevent a resubmitting of the form? the code is basically the same as in somas example: <?php if($input->post->submit){ $n = 1; $title = "profession_$n"; $page->setOutputFormatting(false); while($input->post->$title){ // on first round remove all repeater items, to keep things easy. // teasers is the repeater field if($n == 1) $page->professions->removeAll(); // create new repeater item $item = $page->professions->getNewItem(); // populate any fields in the repeater you want $item->profession = $input->post->$title; // save the repeater item (a page itself) $item->save(); // add the repeater item to the page $page->professions->add($item); // update counter and field names $n++; $title = "profession_$n"; echo $n . "done"; } if($n > 1) { // save the page $page->save('teasers'); echo "save"; } } ?> <form name="test" method="post"> <?php $count = 1; foreach($page->professions as $key => $t): ?> <input type="text" name="profession_<?php echo $key+1?>" value="<?php echo $t->profession?>"/> <?php $count++; endforeach; ?> <input type="text" name="profession_<?php echo $count; ?>" value=""/> <!--<input type="text" name="profession_<?php $count++; echo $count; ?>" value=""/>--> <input type="submit" name="submit" value="submit"/> </form>
  21. i finally found this wonderful post from @Soma, but somehow it behaves strange. the first time i'm adding items everything works fine. after a reload the freshly added repeaters are shown as expected. but when i add some new repeater rows i get duplicates of the old ones. everytime i reload the page and try to add/edit repeater items they get more. is there an update to somas code?
  22. THANKS THANKS THANKS! with you help i build a somewhat frankensteinmonster code but it works. is there any chance i can return the favor and buy you a cup of coffee (paypal :)?)
  23. @abdus i don't mean to bug you. but do you have any tips? if not thats also fine! i asked a friend – who bought the profields matrix – to give it a try and the setup still slows down massively when cycling through the fields. or is it only working faster with the table fieldtype? then i would buy it now. thanks again for your enormous help yesterday! i really appreciate it!
×
×
  • Create New...