Title: Dynamic PHP JS
Last modified: August 20, 2016

---

# Dynamic PHP JS

 *  [p15](https://wordpress.org/support/users/p15/)
 * (@p15)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/dynamic-php-js/)
 * Hi I am trying to mash together a dynamic drop down content from [Dynamic Drive](http://www.dynamicdrive.com/dynamicindex17/dddropdownpanel.htm)
   with WordPress. I have the wordpress side of it working creating various tabs
   and content from child categories but I am struggling to make the JS side of 
   it “Dynamic” Basically the code i currently have is
 *     ```
       <? $var = ". $category->category_nicename."; ?>
       <?php
       $args=array('orderby' => 'id', 'order' => 'DESC');
       $categories=get_categories('child_of=54'); foreach ($categories as $category) {
       var defaultpanel=new ddpanel({
       	ids: ["<? echo $var; ?>panel", "<? echo $var; ?>content", "<? echo $var; ?>tab"], // id of main panel DIV, content DIV, and tab DIV
       	stateconfig: {initial: "0px", persiststate: true}, // initial: initial reveal amount in pixels (ie: 5px)
       	animate: {enabled: true, steps: 5}, //steps: number of animation steps. Int between 1-20. Smaller=faster.
       	pointerimage: {enabled: true, src: ["arrow-down.gif", "arrow-up.gif"]},
       	closepanelonclick: {enabled: true} // close panel when links or elements with CSS class="closepanel" within container is clicked on?
       })  } ?>
       ```
   
 * The only bit that needs to be dynamic is the id’s at the top. I am using the 
   same $categories=getcategories… etc in the template file. I’m pretty sure this
   can be done but not sure exactly how to make the php work within the JS. I have
   renamed the .js file .php and tried the above code!
 * Any thoughts greatly appreciated!
 * Thanks

The topic ‘Dynamic PHP JS’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [p15](https://wordpress.org/support/users/p15/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/dynamic-php-js/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
