Jump to content

Search the Community

Showing results for tags 'random headlines'.

  • 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
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

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 1 result

  1. Hello All, I've added a "Random Articles" block to the bottom of our article pages, at The Significato Journal. The block is under the headline at the bottom, called: "More Headlines You May be Interested In" I have some questions: a) Is my code efficient and the best method to display 4 random headlines? It's of special concern if a site eventually has tens of thousands of articles, because I'm creating an array of all of the articles pages, and then grabbing 4 random ones. It would be better, I think, if I could create an array of only 4, but I don't see how I can do that and still randomly select from all of them. Here's my code: $random_selectors = "custom_template_file.select_value=article_page.php," . "publish_date<=$now, headline_image_name!="; $random_keys = wire('pages')->find("$random_selectors"); $random_pages = $random_keys->findRandom('4'); echo "<table width='100%' cellpadding='0' cellspacing='10'><tr>"; foreach ( $random_pages as $random_page ) { # ... display headline and image } echo "</tr></table>"; b) Every time I reload an article, the headlines change, which is what I want. Does this break the 1-day template cache on the article, or does the headline block get passed through, with the rest of the page still cached? I'd like to keep the cache running. Here's a sample url, so that you can see it in action: http://significatojournal.com/columns/culture-of-heart/the-living-compass-of-kindness-and-compassionate-love/ Thanks for any feedback! Peter
×
×
  • Create New...