Jump to content

neophron

Members
  • Posts

    174
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by neophron

  1. Hi guys, in a website with a lot of fieldsetpages I want to show in this case accordions, only if a field (body) is populated. This is my faulty code: <?php if ($page->sectionfield_fa_membership->body) : ?> <section class="membership"> <ul uk-accordion> <li itemscope itemprop="mainEntity" itemtype="https://schema.org/Question"> <a class="uk-accordion-title" href> <p itemprop="name">Membership</p> </a> <div class="uk-accordion-content" itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer"> <div itemprop="text"><?= $page->sectionfield_fa_membership->body; ?></div> </div> </li> </ul> </section> <?php endif ?> I'm getting this error: Attempt to read property "body" on null The logic is based on this code: <?php if ($page->body) { echo $page->body; } ?>
  2. Thanks for this cool explanation! I converted an existing website to a multilanguage site with DE and EN. After finishing all steps, I noticed, that in all fields the english tab was the active one. But it had to be the opposite way. So I deactivated / uninstalled the Core -> Language -> Languages Support - Tabs module. Logged out and in and reinstalled the Languages Support - Tabs module. And voilà, now all DE tabs are the active ones.
  3. Good day everyone, I'm wondering if this cool module could help me with the following structure, where all »sub-home« pages have the same template: home (mother page) —> navigation that shows only all child pages from the mother page - about - contact - news - sub-home A (template subhome) —> navigation that shows only all child pages from A -- about A -- contact A -- news A - sub-home B (template subhome) —> navigation that shows only all child pages from B -- about B -- contact B -- news B - sub-home C (template subhome) —> navigation that shows only all child pages from C -- about C -- contact C -- news C I'm using the markup regions templating. Most child pages use the same templates.
  4. Before I switched to PW, I worked with a german CMS (Contao). It stores all media in the classical way in an upload folder. I'm still managing such Contao websites, some of them are meanwhile about 10 years old. e.g. among them is a Contao website with a lot of PDFs, that are updating every 3 or 4 months. I'm trying to organize them in subfolders, but meanwhile it's getting messy. And this is where PW is really useful. Looking back on my website projects, I must say, that the PW file-concept was for most clients a better solution. Some of them worked before with Contao and they appreciated the upload fields in the PW backend. If there is a need for reusing the same image on different places, PW offers some solutions. Recently I purchased this: https://mediamanager.kongondo.com HAPPY NEW YEAR!
  5. Recently I transferred a website from WP to PW. First I had to clone the WP site in order to install it on a different hosting company. It turned out, that this WP installation (about 6 main pages and 20 subpages) with a few images, had the size of about 1 GB! This video helped me: https://www.youtube.com/watch?v=tIurrwfsCOg&list=LL&index=32&t=474s I found in the upload directory a lot of 7000px wide jpgs. Every time an image is uploaded, WP generates about 4 or 5 different size variations and keeps them all in the same directory. There were plugins installed, that all begged for an upgrade. Everywhere in the backend constantly informations from different sources popped up. After I finished the new website in PW, I compared the amount of the generated html code. The PW code was about 80% smaller.
  6. Now for everybody, who looks how to include files from a subdirectory: In site/templates/includes/menu_main.php render the file by: <?php echo wireRenderFile('includes/menu_main.php'); ?>
  7. Thanks for this hint. PW offers really a lot modifications. This is part of the html backend structure, seen from a non admin: <div class="PageListItem PageListTemplate_video PageListNoChildren PageListID1226 PageListStatusUnpublished secondary PageListStatusHidden PageListItemHover" data-numtotal="0" data-numchild="0"> <a href="#" title="/video-container/video-03/" class="PageListPage label"> <i class="icon fa fa-fw fa-video-camera"></i> Video 03 | video </a> ... </div> It would be cool, if {template.name} could be wrapped in a display: not span, that is loaded only if a user is logged in.
  8. Thanks a lot @BitPoet Nr 3 works fine 🙂
  9. I wanted to refresh this, cause meanwhile the new name of module is »Page List«. Modules --> Core --> Page List --> {title} | {template.name} But recently I noticed, that adding an icon to a template removes the template name. And now I have two questions: Is there a way to show both? Is there a way to hide the template names for non admins?
  10. Trying to get property 'media_manager_v_single' of non-object
  11. 10 years later! Searching for a getRandom() solution from a repeater, I stumbled upon this thread. I have the repeater_headline_movie_text with the field media_manager_v_single. My goal is to render only one repeater item randomly. This is my bad code: <? foreach ($page->repeater_headline_movie_text->getRandom() as $item) : ?> <article class="video_article"> <h3><?= $item->headline; ?></h3> <?php $out = $item->media_manager_v_single->each(function ($resource) { return "<video src='{$resource->media->url}' poster='{$resource->media->poster}' width='720' height='408' controls></video>"; }); echo $out; ?> <div class="textwrapper"> <?= $item->body_second; ?> </div> </article> <? endforeach; ?>
  12. Hi Adrian, thanks for your suggestion. Yes, now I see what's missing. The logic must be: Select the page, check if there is a field video_field inside and render the content. And I think that this php-logic causes me headache 😕
  13. Struggling with page reference inside repeater Hi, since the video files are usually bigger then some jpgs, I wanted to reuse uploaded video files on a website. There is a page reference field select_video inside a repeater. The file field for the videos is video_field. In a hidden page "video-container" are hidden child pages. Each child pages has a single video. I want to show each video via the page reference (inside a repeater) on a different page. In the field video_field under Basics -> Type the option Files is active. This is my code, where only headline and body_second are rendered. <? foreach ($page->repeater_headline_movie_text as $item) : ?> <h3><?= $item->headline; ?></h3> <article class="video_article"> <?php if ($item->select_video->id) : ?> <?php $file = $item->video_field; if($file) { echo "<video width='{1280}' height='{710}' poster='{$file->video_field->poster}' controls='controls' preload='yes'> <source type='video/mp4' src='{$file->video_field->url}' /> <track kind='subtitles' src='{subtitles}' srclang='de' /> </video> "; } ?> <?php endif; ?> <div class="textwrapper"> <?= $item->body_second; ?> </div> </article> <? endforeach; ?>
  14. Hi, maybe some of you already know this project: https://utopia.fyi They offer a type-, space- and grid-calculator for fluid design, no breakpoints. All these are actually clamp-clalculators.
  15. Using wireRenderFile doesn't render the stuff. Using wireIncludeFile works right now. No idea what's wrong cause there are no errors (even with tracy).
  16. Thanks. I think I found the error: It's the famous <?php namespace ProcessWire; Solution: all included php files should start with a <?php namespace ProcessWire; And in my case now it looks like this: <?= wireIncludeFile('includes/menu_main.php'); ?>
  17. Hi guys, I'm struggling with including php files from a subfolder. Maybe because there are more then one solution. I'm using the $config->useMarkupRegions = true; with the _main.php. Right now I have some php files that I include in the template files like this: <?php include('menu_main.php'); ?> Now I have this subfolder: /templates/includes This won't work: <?php include('includes/menu_main.php'); ?> Using <?php wireIncludeFile('includes/menu_main.php'); ?> works only with the menu_main.php file, but not with others. What would you suggest?
  18. Hi, years ago I build a website with about 12 subdomains. It’s representing an association with 12 local groups. There are 12 users, each user has access to only one subdomain. The current cms is Contao (a german cms), some of you probably heard about or worked with. The problem now is a human one. Many users are uploading a lot of sh*t, such as a ton of almost the same gallery images, that are too big or too small. You can’t educate them by setting limitations like in the fields with PW. I found also whole html tables with inline styles, that were copied from somewhere and pasted into the editor. So I’m wondering, if this would be a good strategy, to install PW with the multisite plugin and to rebuild the old website with all subdomains. Which problems could I face with 12 subdomains and 12 users, that should have access only to their subdomain pages? Does anybody of you guys has some experience of this kind?
  19. You're absolutely right. I wrote my question too hasty. I'm gonna find a different way for applying a color to a teaser.
  20. Hi there, meanwhile the client had a new wish and I need your help again. An archive page shall contain children, which will be moved there manually. Structure:archive (archive) --> shows teaser from child pages child-page 02 child-page 01 child-page 03 child-page 01 child-page 01 child-page 02 The classical way to echo child pages is by: <?php foreach ($page->children() as $teaser) : ?> But I need again the data from the color_field mentioned above <?= $teaser->parent->select_color->title; ?> The logic now would be something like this: Find all children from parent=1223|1224|1225 and echo a teaser only if they are children from archive
  21. Hi guys, 5 years later… for separating the date components from a date field, I found this solution. This works fine. <?php $d = strtotime($page->datefield); echo date('d', $d) . '<br>'; //e.g 8 echo date('F Y', $d); //e.g. November 2015 ?> But I want to germanize the output. I tried this: <?php setlocale(LC_ALL, 'de_DE.UTF-8'); $d = strftime("%d. %B %G", strtotime($veranstaltung->datefield)); echo date('%d.', $d) . '<br>'; echo date('%B', $d); ?> But I'm getting an error: A non well formed numeric value encountered In my config.php I have these lines: $config->timezone = 'Europe/Berlin'; setlocale(LC_ALL, 'de_DE.UTF-8'); I don't know, if these settings from the date field are correct
  22. Thanks! Now it works fine ? I'm going to have a look at this »Latte«
×
×
  • Create New...