Jump to content

lenoir

Members
  • Posts

    146
  • Joined

  • Last visited

Posts posted by lenoir

  1. 2 hours ago, virtualgadjo said:

    would be happy to see but just aword to say that i use a lot of svg and src="<?= ...->url" ;?>" works fine if you just want to display it as an img

    I use SVGs a lot as images too, but in some cases I want to be able to interact with some elements in the SVG (change the colors, animate elements with CSS, etc.), and you can't do that if they're inserted within an <img> tag.

  2. 1 hour ago, BitPoet said:

    It worked, but it's a pretty roundabout way to go about it, as the server performs a http GET for the SVG to retrieve its contents. But my bad, path is the wrong property. Try "filename" instead.

    Actually a good point, thank you. I was getting an error message on another device, so filename is probably cleaner. 

    You think there's better way to get the SVG without the http GET? 

  3. Hi,

    I'm often struggling with placing SVG images as SVGs (not within an img or object tag). I'm getting the following error message:

    Warning: file_get_contents(/site/assets/files/1022/schlaeger_1.svg): Failed to open stream: No such file or directory

    Here's my code:

    echo file_get_contents("{$content->images->eq(0)->url}");

    ($content is a repeater)

    What is the correct way to place a SVG image as SVG (I really need it as a SVG).

    Thanks!

  4. Great module!! It's funny how very often one expects a complex solution to a problem and stumble across a very simple ProcessWire module 😅.

    Still, I've having timeOut issues importing a simple CSV (1.3Mb) after 77 pages already. Expecting to import >2000. 

    What's the workaround? I've installed Tasker, but I'm not sure how it works. 

    Can anyone help me? Thanks!

  5. I need to display a datetime field next to the title of the page on the tree list. I've used the following code in the ready.php file previously, but it's not working anymore. Also, I'm looking at displaying the date on the tree, not in the search. 

    Am I doing something wrong? Unfortunately I'm not familiar with hooks…

    $wire->addHookBefore('ProcessPageSearchLive::execute', function(HookEvent $event) {
        $event->wire()->addHookAfter('FieldtypePageTitle::wakeupValue', function(HookEvent $event) {
    
            $page = $event->arguments(0);
            
            if($page->template == 'event') {
                
                $suffix = $page->datum;
    
                $event->return .= ", {$suffix}";
    
            }
    
        });
    });

     

  6. Hi,

    I need to export a JSON once a day automatically. It should contain a whole set of pages and their direct subpages:

    Agenda
    -> Play 1 (text, images)
         -> Play 1 date 1 (diverse fields, datetime)
         -> Play 1 date 2
    -> Play 2
         -> Play 2 date 1

    I'm not sure where to do this and where to save the JSON file. I'm thinking of a hook in ready.php but I haven't done this before, so I'm a bit cautious.

    Thank you for your help!

  7. Just now, MarkE said:

    When you create a repeater field, say 'fieldname', PW automatically creates a template called 'repeater_fieldname'. It looks like you are using this, not the actual field name. If you actually called your field 'repeater_agenda' then the template will be called 'repeater_repeater_agenda' (check your templates list with system templates filter turned on). I wanted to eliminate the possibility that you might be calling the template rather than the field.

    Oh I didn't know this. I actually started calling all my repeaters "repeater_…" but that might not be the brightest idea in that case. But I find sometimes forget which fields are repeaters and which aren't, that's why I started doing this.

    But I guess this isn't the problem, since I'm pointing to the right field.

  8. Hi,

    this seemed quite straight forward, still can't get my head around it…

    I have a repeater with 2 fields (title and datetime). I want to sort the repeater items in the API by the datetime field. But it doesn't work. 

    foreach($page->repeater_agenda->sort("eventdate") as $agenda){
    
    }

    This doesn't do anything. Am I missing something?

  9. Hi,

    I've been using PW on so many websites to this day, can't count them. Still, I'm always looking for a better way to name my fields. A typical problem is when I need multiple textfields on one template.

    I sometime contextualize them (i.e. "lead", "maintext", "detailinformation", etc.) or use "textfield_1", "textfield_2", etc., and I even tried to differentiate them by their type or max characters ("textfield_formatted", "textfield_unformatted", or "textfield_500", …) 

    So my question is… What solution have you found to this issue?? ?

  10. 13 minutes ago, Klenkes said:

    I did something like you want. Add this hook to ready.php:

    $wire->addHookBefore('ProcessPageSearchLive::execute', function(HookEvent $event) {
    	$event->wire()->addHookAfter('FieldtypePageTitle::wakeupValue', function(HookEvent $event) {
    
    		$page = $event->arguments(0);
    		
    		// specify your temlate
    		if($page->template == 'tool') {
    
          		// get the fields you like
    			$prefix = $page->pre;
    			$suffix = $page->suf;
    
    			// add your data to the list
    			$event->return .= " | {$prefix} {$suffix}";
    
    		}
    
    	});
    });

     

    Wow, thanks! That's exactly it. ?

    • Like 1
  11. I'm talking about ProcessPageSearch. Concrete case: the user searches a particular page in the search field top right corner. If they type the name of a tree, there's a bunch of pages that will display with that particular tree. I would need it to display a second field with the location. So they see in the result "tree, location".

    I'm also using ProcessPageList (which is perfect for displaying the pages in the tree (this time I'm talking about the tree of pages in the backend ?). But this is a different need.

    Lister might be an alternative solution, actually ?

    • Like 1
  12. On 5/20/2021 at 9:47 AM, gebeer said:

    I took @bcartier's code from this post and made a configurable module from it.

    change-default-frontend-lang.png.a23bdeaf2a364995919ce3605bfeaa0a.png

    You can find the module attached.

    I can confirm that the redirection to a non-default language works on PW 3.0.172

    DefaultFrontendLanguage.zip 1.35 kB · 49 downloads

    Thanks Gebeer, that was definitely a time saver. Works fine for me. Couldn't go into the trouble of swapping languages by default, not with all content already up there.

  13. Is it possible to let people edit a page without having to have a user-role?

    My case is the following:

    Visitors fill in a form (Formbuilder) which is saved to pages. They get a confirmation email which could contain a unique editing link. In case they need to update some information, they can click on this link, edit the fields and save. 

    Am I totally off? Is there a better practice? 

×
×
  • Create New...