tribulant

FAQ Questions Loop to Execute PHP Code

Apr 8th, 2011
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.43 KB | None | 0 0
  1. <?php if (!empty($questions)) : ?>
  2.     <?php if ($this -> get_option('acc') == "Y") : ?>
  3.         <div class="<?php echo $this -> pre; ?>acc" id="<?php echo $this -> pre; ?>acc<?php echo $group -> id; ?>">
  4.             <?php foreach ($questions as $question) : ?>
  5.                 <h4 class="<?php echo $this -> pre; ?>acctoggle"><a style="background:url('<?php echo $this -> url(); ?>/images/bullets/<?php echo $this -> get_option('accbullet'); ?>.png') center left no-repeat;"><?php echo $question -> question; ?></a></h4>
  6.                 <div class="<?php echo $this -> pre; ?>acccontent">
  7.                     <div class="<?php echo $this -> pre; ?>acccontenti">
  8.                         <?php if ($this -> get_option('showquestionexcerpts') == "N" || ($this -> get_option('showquestionexcerpts') == "Y" && $question -> pp == "none")) : ?>
  9.                             <?php echo do_shortcode(wpautop(exec(stripslashes($question -> answer)))); ?>
  10.                         <?php else : ?>
  11.                             <?php
  12.                            
  13.                             global $post;
  14.                             $post = get_post($question -> pp_id);
  15.                             $post -> post_content = $question -> answer;
  16.                             setup_postdata($post);
  17.                             the_excerpt();
  18.                            
  19.                             ?>
  20.                         <?php endif; ?>
  21.                        
  22.                         <?php if (current_user_can('edit_plugins') && $this -> get_option('adminlinks') == "Y") : ?>
  23.                             <p>
  24.                                 <small>
  25.                                     <?php echo $wpfaqHtml -> link(__('Edit Question', $this -> plugin_name), $wpfaqHtml -> admin_qu_save($question -> id)); ?>
  26.                                     | <?php echo $wpfaqHtml -> link(__('Delete Question', $this -> plugin_name), $wpfaqHtml -> admin_qu_delete($question -> id), array('onclick' => "if (!confirm('" . __('Are you sure you wish to remove this question permanently?', $this -> plugin_name) . "')) { return false; }")); ?>
  27.                                 </small>
  28.                             </p>
  29.                         <?php endif; ?>
  30.                     </div>
  31.                 </div>
  32.             <?php endforeach; ?>
  33.         </div>
  34.        
  35.         <?php $accactive = $this -> get_option('accactive'); ?>
  36.         <?php if (empty($accactive)) { $dontopen = true; }; ?>
  37.        
  38.         <script type="text/javascript">
  39.         jQuery(document).ready(function() {
  40.             jQuery("#wpfaqacc<?php echo $group -> id; ?>").accordion({
  41.                 <?php echo (empty($dontopen) || $dontopen == false) ? 'active:' . ($accactive - 1) . ',' : 'active:"0",'; ?>
  42.                 header: "h4.wpfaqacctoggle",
  43.                 event: "<?php echo ($this -> get_option('accevent') == "over") ? 'mouseover' : 'click'; ?>",
  44.                 autoHeight: false
  45.             })
  46.         });
  47.         </script>
  48.     <?php elseif ($this -> get_option('clickoc') == "Y") : ?>      
  49.         <div class="<?php echo $this -> pre; ?>" id="<?php echo $this -> pre; ?><?php echo $group -> id; ?>">
  50.             <?php foreach ($questions as $question) : ?>
  51.                 <h4 class="<?php echo $this -> pre; ?>toggle" style="background:url('<?php echo $this -> url(); ?>/images/bullets/<?php echo $this -> get_option('accbullet'); ?>.png') center left no-repeat;"><?php echo $question -> question; ?></h4>
  52.                 <div class="<?php echo $this -> pre; ?>content" style="display:none;">
  53.                     <div class="<?php echo $this -> pre; ?>contenti">
  54.                         <?php echo do_shortcode(wpautop(exec(stripslashes($question -> answer)))); ?>
  55.                        
  56.                         <?php if (current_user_can('edit_plugins') && $this -> get_option('adminlinks') == "Y") : ?>
  57.                             <p>
  58.                                 <small>
  59.                                     <?php echo $wpfaqHtml -> link(__('Edit Question', $this -> plugin_name), $wpfaqHtml -> admin_save('questions', $question -> id)); ?>
  60.                                     | <?php echo $wpfaqHtml -> link(__('Delete Question', $this -> plugin_name), $wpfaqHtml -> admin_delete('questions', $question -> id), array('onclick' => "if (!confirm('" . __('Are you sure you wish to permanently remove this question?', $this -> plugin_name) . "')) { return false; }")); ?>
  61.                                 </small>
  62.                             </p>
  63.                         <?php endif; ?>
  64.                     </div>
  65.                 </div>
  66.             <?php endforeach; ?>
  67.         </div>
  68.        
  69.         <script type="text/javascript">
  70.         jQuery(document).ready(function() {
  71.             jQuery('h4.<?php echo $this -> pre; ?>toggle').click(function() {
  72.                 jQuery(this).next("h4 + div.<?php echo $this -> pre; ?>content").slideToggle();
  73.             });
  74.         });
  75.         </script>
  76.     <?php else : ?>
  77.         <div class="<?php echo $this -> pre; ?>" id="<?php echo $this -> pre; ?><?php echo $group -> id; ?>">
  78.             <?php foreach ($questions as $question) : ?>
  79.                 <h4 class="<?php echo $this -> pre; ?>toggle" style="background:url('<?php echo $this -> url(); ?>/images/bullets/<?php echo $this -> get_option('accbullet'); ?>.png') center left no-repeat;"><?php echo $question -> question; ?></h4>
  80.                 <div class="<?php echo $this -> pre; ?>content">
  81.                     <div class="<?php echo $this -> pre; ?>contenti">
  82.                         <?php echo do_shortcode(wpautop(exec(stripslashes($question -> answer)))); ?>
  83.                        
  84.                         <?php if (current_user_can('edit_plugins') && $this -> get_option('adminlinks') == "Y") : ?>
  85.                             <p>
  86.                                 <small>
  87.                                     <?php echo $wpfaqHtml -> link(__('Edit Question', $this -> plugin_name), $wpfaqHtml -> admin_save('questions', $question -> id)); ?>
  88.                                     | <?php echo $wpfaqHtml -> link(__('Delete Question', $this -> plugin_name), $wpfaqHtml -> admin_delete('questions', $question -> id), array('onclick' => "if (!confirm('" . __('Are you sure you wish to permanently remove this question?', $this -> plugin_name) . "')) { return false; }")); ?>
  89.                                 </small>
  90.                             </p>
  91.                         <?php endif; ?>
  92.                     </div>
  93.                 </div>
  94.             <?php endforeach; ?>
  95.         </div>
  96.     <?php endif; ?>
  97. <?php else : ?>
  98.     <p><small class="<?php echo $this -> pre; ?>error"><?php _e('No questions were found', $this -> plugin_name); ?></small></p>       
  99. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment