Jump to content

protro

Members
  • Posts

    18
  • Joined

  • Last visited

Everything posted by protro

  1. Nevermind I realize now that it's pulling from the file field description // default title source and formatting: $titleOut = $mp3->description ?: $mp3->name; // default $titleAtt = $mp3->description ?: $mp3->name; // attribute
  2. Thanks @Macrura, Also is there a way to pass in a Page's fields to control to Bar-UI Track Title Template if I didn't want to rely on ID3 tags? What are these tokens {title} referencing ? <span itemprop="name">{title}</span>
  3. Thank you so much @Macrura you set me on the right path. I appreciate you taking the time explaining something this elementary. Since I am using Rockfrontend with the Latte engine, I had to do some alteration to the syntax, but the playlist/GUI is working now πŸ™‚ {var $options = ['type' => 'bar-ui', 'skin' => 'gradient-fat',]} {var $songPages = $pages->get('creative')->children} {var $empty = new \ProcessWire\WireArray()} {foreach $songPages as $song} {var $playlist = $empty->import([$song->audio_file])} {/foreach} {$sm2->player($playlist, $options)|noescape} I had to make sure to call \ProcessWire\WireArray from within this .latte template file, and to add a noescape to the $sm2 object. I was also getting stuck by not wrapping the audio_file File Field in an array, as I was doing this initially, which returned WireArray cannot import non arrays or non-iterable objects {$playlist->import($song->audio_file)} Looking forward to playing with this module some more. Many thanks.
  4. Thank you @Macrura I finally got the player GUI to load, but am getting errors and nothing will play. I suppose I am not understanding what $page->audio is really doing. Is that a ProcessWire Audio class on any page? is `audio` the name of a tag? I installed Tracy and don't really understand what these errors mean. I'm doing exactly what is in your documentation. I am attempting to put a playlist on the homepage sidebar using this include playlist.php <?php $options = [ 'type' => 'bar-ui', 'skin' => 'gradient-fat', ]; echo $sm2->player($page->audio, $options); But the page with the Audio File Field is called 'Song-1'. I have a template called Songs with children Song-1, Song-2, etc. and I am trying to add them to a playlist. So I thought $page->audio looks like it's trying to reference the current page, let me try $pages->get('template=Song')->audio … but that does not seem to work. Thanks for your help I feel like this is almost working. Took a long time just getting the GUI up.
  5. Can't seem to get this to work on local dev environment. Looks really cool. Just not understanding how to get the player generated. CSS + JS is loading in the page. I have manually declared swf. I have declared the module in _init.php I have a text field `tag-audio` with the Soundmanager2 textformatter applied in the field Details settings pane. I have Tags enabled on the file field and am using `audio` as the tag on the file. I have the Assets Output Method set to Module API. Seems like I tried everything but neither this nor this works. // in Latte this doesn't work {var $options = ['type' => 'bar-ui', 'skin' => 'gradient-fat',]} {$sm2->player($page->audio, $options)} // neither does calling the shortcode directly from the textformatter field {$pages->get('song-1')->tag_audio} // [smplayer tag=audio]
  6. Hello ProcessWire Community, It is with great pleasure that I share with you the new site for our company Strangeloop Studios, a visual design lab and animation studio based in Los Angeles. We specialize in content for musical artists but have branched into VR, Broadcast, and Music Video projects as well. This is my first site using ProcessWire. I went from complete PW beginner (October 2022) to this re-design and catalog of our various projects in the space of several months. Lurking here on the forums and visiting all of the stellar work that gets shared on the Showcases has taught me a lot. Many thanks to @bernhard for the Rockfrontend module, and @flydev for their Duplicator module. I probably wouldn't have been able to get this far without those … so, many thanks for your contributions! I also appreciate the feedback to my questions in the forums from several users who have improved my understanding of PW with detailed explanations. Things I would like to improve: optimizations for image delivery Multi-language support Looking forward to building more with ProcessWire! Cheers,
  7. Thank you for creating and sharing this module with the community! I have a very elementary question. I've hit some blockage with this. How do you validate and call the module's methods? Directly in the template? External php file? I create a form for email subscribe. <form method="post" action="{$config->urls->assets}inc/mailchimp.php"> <label for="email">Email:</label> <input type="email" id="email" name="email" required> <input type="submit" value="Subscribe"> </form> In the mailchimp.php file I am attempting to validate and call your module's methods. But seem unable to even access any .php file in the PW installation. <?php //load module into template $mc = $modules->get("SubscribeToMailchimp"); $v = new Valitron\Validator($_POST); $v->rule('email', 'email'); if($v->validate()) { // The email address is valid $mc = $modules->get("SubscribeToMailchimp"); $email = $input->post->email; $subscriber = [ 'FNAME' => $input->post->firstname, 'LNAME' => $input->post->lastname, ]; $mc->subscribe($email, $subscriber); } else { // The email address is not valid, display the error messages $errors = $v->errors(); print_r($errors); } It seems I can't call an external php file in Processwire per htaccess rules. Any help / pointers would be very much appreciated.
  8. thanks for chiming in @dotnetic @teppo @gebeer I will re-consider the approach in my template. I was hitting performance issues with video thumbnails on mobile so I wanted to cancel displaying them if the user was on mobile (via Latte template query) and display a still image instead, but I guess this was the wrong approach. I will see if I can tackle the template logic differently and explore @media queries in CSS further. Many thanks for the feedback.
  9. Very strange @Stefanowitsch. I copied into my project MobileDetect.php and am receiving this error in my env (MAMP using PHP 8.0.8) syntax error, unexpected 'array' (T_ARRAY), expecting function (T_FUNCTION) or const (T_CONST)
  10. Unfortunately it seems MobileSupport.php is not supported in PHP 8.x.x versions. I'm getting errors in VS Code on that MobileDetect.php file. I'll keep my eye on this though.
  11. Thanks very much @gebeer. I was uncertain how to manually install third-party scripts as I am not comfortable with Composer right now. I appreciate this explanation!
  12. Answering my own question in case it is helpful to anyone else. I am using Processwire and Rockfrontend. I was able to get a custom mobile detection to work using PHP by adding a custom function to _init.php (and taking care to comment out the PW namespace as per RF repo documentation). <?php // namespace ProcessWire; // Optional initialization file, called before rendering any template file. // This is defined by $config->appendTemplateFile in /site/config.php. // Use this to define shared variables, functions, classes, includes, etc. function isMobileDevice() { // Get the user agent string $userAgent = $_SERVER['HTTP_USER_AGENT']; // Check if the user agent matches any common patterns for mobile devices if (preg_match('/android|iphone|ipod|blackberry|iemobile|opera mobile|palmos|webos/i', $userAgent)) { return true; } else { return false; } } Then I was able to call the function in the normal way with Latte: {if isMobileDevice() == 'true'} πŸ™‚
  13. Thanks for your response @wbmnfktr … I am aware that these things can be done with css/js … I was more interested in trying something outside my familiarity with php. Here's a follow-up question: how can I write a custom function and access it in a template file in Processwire? Inside of _init.php I have added a user-agent regex for mobile detection <?php namespace ProcessWire; // Optional initialization file, called before rendering any template file. // This is defined by $config->appendTemplateFile in /site/config.php. // Use this to define shared variables, functions, classes, includes, etc. function isMobileDevice() { // Get the user agent string $userAgent = $_SERVER['HTTP_USER_AGENT']; // Check if the user agent matches any common patterns for mobile devices if (preg_match('/android|iphone|ipod|blackberry|iemobile|opera mobile|palmos|webos/i', $userAgent)) { return true; } else { return false; } } So why do I get: Call to undefined function isMobileDevice() when trying to access this function with inside of a .latte template: {if isMobileDevice()} I might be missing something very simple. This is some new territory for me. With thanks,
  14. Hello PW forums, I am using PW & Rockfrontend with the Latte template engine. I see there used to be a mobile detect module but it is no longer available. Is there a way to accomplish simple mobile detection using php in Processwire 3.x.x ? Thanks,
  15. Thank you for this terrific module. Sorry if basic question: What is best methodology for simply updating the database on a production server if the rest of the site content / processwire core have already been deployed?
  16. Any good strategies for avoiding FOUT (Flash of unstyled text) when using Rockfrontend? I am loading the styles as in your video tutorial in the <head>: $rockfrontend ->styles()->setOptions(['autoload'=>true]) // ->add("/site/templates/uikit-3.15.10/src/less/uikit.theme.less") ->add("/site/templates/styles/custom.less") And then before </head> I import the Google Fonts <!-- fonts --> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?&family=Major+Mono+Display&family=Oswald:wght@200;300;400;500;600;700&family=Silkscreen&display=swap" rel="stylesheet"> Wonder what some possible solutions would be. I tried display=block but that causes layout inconsistencies on page load. Any solutions or techniques much appreciated.
  17. I am trying to retrieve a config value to be shared with javascript using a $config->js() declaration at the top of _main.php: $config->js('mySettings', [ 'lightLogo' => $pages->get('logo-alpha-light')->image->url, 'darkLogo' => $pages->get('logo')->image->url, ]); in main.js when I try to access mySettings the console shows: ReferenceError: ProcessWire is not defined What am I missing? This is the first line in main.js var mySettings = ProcessWire.config.mySettings;
  18. Hello Processwire peoples. I am a new user and very much enjoying the possibilities afforded by this CMF. I was trying to accomplish $page->children() but exclude returned pages that themselves contained children (I am calling them grandchildren here). I came up with this finally, which seems to work. It excludes the child page that contained children and merges its children with the rest of the original page's children, and sorts in descending chronological order. I am using Rockfrontend and Latte: {var $children = $page->children()->not("children.count>0")} {var $grandChildren = $page->children("children.count>0")->children()} {var $items = $children->append($grandChildren)->sort("-date")} {foreach $items as $item} I find the documentation here a bit confusing. For example I wish I had a list of the system fields belonging to a page. I have trouble locating what the available selectors are. Any help or alternatives much appreciated πŸ™‚
Γ—
Γ—
  • Create New...