Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Sign In
Not a member yet? Click here to register.

Accordion Atom-X Theme v7

help me use the accordion :
echo accordion($id, $array);


CodeDownload  
 function accordion($id, $array) {
 $html = "<div class='accordion' id='$id'/>\n";
 foreach ($array as $field_id => $data) {
 $active = ($field_id == '0') ? 'in' : '';
 $child = ($field_id == '0') ? '' : 'accordion-n';
 $title = str_replace('/[^A-Z]+$/i', " ",$data['title']);
 $title_id_cc = str_replace(" ", "-", $title);
 $html .= "<div class='accordion-group'>";
 $html .= "<div class='accordion-heading'>";
 $html .= "<a class='accordion-toggle $child' data-toggle='collapse' data-parent='#$id' href='#".$title_id_cc."-".$id."'/> ".$title." <i class='entypo cw'/></i></a>";
 $html .= "</div>\n";
 $html .= "<div id='".$title_id_cc."-".$id."' class='accordion-body collapse $active'><div class='accordion-inner'>\n";
 $html .= $data['content'];
 $html .= "</div></div></div>\n";
 }
 $html .= "</div>\n";
 return $html;
 }

hervan attached the following image:
screenshot_2019-05-31_official_home_of_php-fusion.png
As far as I know, pf-7 is no longer supported here. Try asking in the national forums of php-fusion v7 support, maybe they can help you there.
No, it's alright to ask here as long as we know what's going on. After all this site is open to our community members.

CodeDownload  

function accordion($id, $array) {
 $html = "<div class='accordion' id='$id'/>\n";
 foreach ($array as $field_id => $data) {
 $active = ($field_id == '0') ? 'in' : '';
 $child = ($field_id == '0') ? '' : 'accordion-n';
 $title = str_replace('/[^A-Z]+$/i', " ",$data['title']);
 $title_id_cc = str_replace(" ", "-", $title);
 $html .= "<div class='accordion-group'>";
 $html .= "<div class='accordion-heading'>";
 $html .= "<a class='accordion-toggle $child' data-toggle='collapse' data-parent='#$id' href='#".$title_id_cc."-".$id."'/> ".$title." <i class='entypo cw'/></i></a>";
 $html .= "</div>\n";
 $html .= "<div id='".$title_id_cc."-".$id."' class='accordion-body collapse $active'><div class='accordion-inner'>\n";
 $html .= $data['content'];
 $html .= "</div></div></div>\n";
 }
 $html .= "</div>\n";
 return $html;
}

$array = [
 0 => [ // must start with 0 always
 'title' => 'Example 1',
 'content' => 'This is a content 1',
 ],
 1 => [
 'title' => 'Example 2',
 'content' => 'This is a content 2'
 ]
];

echo accordion('my-accordion', $array);

thank you for helping me
Not a problem. I tend to miss threads for technical questions. If you need help and contact, all our core team members are literally online on Discord to make all of us very accessible.
When it comes to code questions, Forum is the correct place to be. You can however, ping the Dev in discord to point em in the right direction of a thread.
Thread Information
Author
Posted In
Replies
6 posts
Views
391 times
Last Post
Last updated on 6 months ago
You can view all discussion threads in this forum.
You cannot set up a bounty in this discussion thread.
You can start a new discussion thread in this forum.
You cannot reply in this discussion thread.
You cannot start on a poll in this forum.
You cannot upload attachments in this forum.
You can download attachments in this forum.
You cannot up or down-vote on the post in this discussion thread.
Users who participated in discussion: Falk, Chan, zizub, hervan