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.
hervan

Accordion Atom-X Theme v7

by hervan, Last updated on 18 days ago in Themes Support
help me use the accordion :
echo accordion($id, $array);


 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:
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.


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);
Lead Developer of PHP-Fusion
Developer Tweet: https://twitter.com/phpfusion_tweet
hervan has replied to this - 21 days ago
thank you for helping me
Chan has replied to this - 21 days ago
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.
Lead Developer of PHP-Fusion
Developer Tweet: https://twitter.com/phpfusion_tweet
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.
Need help?, Having trouble?
• View our Documentation for Guides, Standards and Functions
• Name and Organize your content correctly in the corresponding Forums for best support results
• Attaching Log Files and Screenshots when reporting issues will help
• Please read and comply with the Code of Conduct

(¯`·._.·(¯`°·._.·°º*[ Project Manager ]*º°·._.·°´¯)·._.·´¯)
You can view all discussion threads in this forum.
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.
Users who participated in discussion: Falk, Chan, zizub, hervan