Jump to content

legato89

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by legato89

  1. Wire->__call('setOutputFormat...', Array) PageArray->setOutputFormatting(false)
  2. # if: no ad specified; choose at random if ( $ad_page instanceof NullPage ) { $ad = $pages->get('parent=1304, sort=random, include=hidden, limit=1'); } # else: display the specified ad else { $ad = $ad_page; } # end if ...and then how the ad is displayed plus the ad counter code $display_sidebar .= $ad->body; # Update this ad's view count $ad_views = $ad->ad_views; $count = ( empty($ad_views) ) ? 1 : $ad_views + 1; $ad->setOutputFormatting(FALSE); $ad->set('ad_views', $count); $ad->save('ad_views'); } # else: else { $display_sidebar .= $content->sidebar; } # end if $display_sidebar .= '</div>' . LF; } # end loop } # end if echo $display_sidebar; ?> Edit: I got it working, kind of. I had to comment out lines 89-91 to get rid of the error message I kept getting, and use the echo you included instead of having it displayed at line 83.
  3. Thanks for your help. I think the issue may be how the code is being generated further down: $display_sidebar .= $ad->body; # Update this ad's view count $ad_views = $ad->ad_views; $count = ( empty($ad_views) ) ? 1 : $ad_views + 1; $ad->setOutputFormatting(FALSE); $ad->set('ad_views', $count); $ad->save('ad_views');
  4. Three. I did try your code and I am receiving an error: Call to a member function findRandom() on a non-object
  5. There are around 8. Currently, the children will display and randomly be chosen after each refresh.
  6. I'm having an issue getting multiple random ads to display. Currently, pages created under the parent page 1304 are chosen at random using ->get() and displayed fine. The issue occurs when trying to display multiple ads. The same ad is chosen and displayed. Here is my code: if ( $ad_page instanceof NullPage ) { $ad = $pages->get('parent=1304, sort=random, include=hidden, limit=1'); } I have tried using getRandom and find() but to no avail.
×
×
  • Create New...