Jump to content

Search the Community

Showing results for tags 'getRandom'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 2 results

  1. Hi all! having some trouble working with the getRandom - or actually, getting it to work another way. I'm currently selecting a random image from an imageArray by using the getRandom function. Now I want to know which image it picked though, so I thought of using php's own rand() function this way: rand(0, $arrayTitle->count()); Works like a blast, until it hit the first image at $arrayTitle(0)... I get the following error: Error: Uncaught Error: Method name must be a string in /Users/JCN/Sites/ffa/wire/core/WireArray.php:1648 Stack trace: #0 /Users/JCN/Sites/ffa/site/templates/head.inc(12): WireArray->__invoke(0) #1 /Users/JCN/Sites/ffa/site/templates/home.php(1): include_once('/Users/JCN/Site...') #2 /Users/JCN/Sites/ffa/wire/core/TemplateFile.php(182): require('/Users/JCN/Site...') #3 /Users/JCN/Sites/ffa/wire/core/Wire.php(398): TemplateFile->___render() #4 /Users/JCN/Sites/ffa/wire/core/Wire.php(333): Wire->runHooks('render', Array) #5 /Users/JCN/Sites/ffa/wire/modules/PageRender.module(422): Wire->__call('render', Array) #6 /Users/JCN/Sites/ffa/wire/core/Wire.php(398): PageRender->___renderPage(Object(HookEvent)) #7 /Users/JCN/Sites/ffa/wire/core/Wire.php(333): Wire->runHooks('renderPage', Array) #8 /Users/JCN/Sites/ffa/wire/core/Wire.php(459): Wire->__call('renderPage', Array) #9 /Users/JCN/Sites/ffa/wire/core/Wire.php(333): Wire->runHooks('render', Array) #10 /Users/JCN/Sites/ffa/wire/modules/Process/ProcessPageView.module(187) (line 1648 of /Users/JCN/Sites/ffa/wire/core/WireArray.php) ...all other images work fine though. Is this something I can fix in the .htaccess? And how come I've never had this before, in other projects? Love to hear your take on things... cheers!
  2. So I tried using $page->repeater->getRandom() in some template code but it didn't seem to work. Should this work? If not, what is the recommended way of working with a single, randomly-chosen repeater item? Thanks!
×
×
  • Create New...