Skip to content

Instantly share code, notes, and snippets.

@iamrobert
Created May 13, 2022 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamrobert/e380b798daaf5c9ecc0803f1df5c6f7a to your computer and use it in GitHub Desktop.
Save iamrobert/e380b798daaf5c9ecc0803f1df5c6f7a to your computer and use it in GitHub Desktop.
<?php
defined( '_JEXEC' )or die( 'Restricted access' );
use Joomla\ String\ StringHelper;
/* + ACCORDION ITEM > XML FIELDS
======================================================================*/
$pillar = FlexicontentFields::getFieldDisplay( $item, 'investor' );
//print_r($pillar); die;
$investor_body = '';
$investor_nav = '';
$investor_array1 = explode( '[br]', $pillar );
array_pop( $investor_array1 );
foreach ( $investor_array1 as $array ) {
$investor_final[] = explode( ";;", str_replace( "amp;", "", $array ) );
// print_r($array);
}
if ( isset( $investor_final ) ) {
//print_r($investor_array1);
$count = 0;
$len = count( $investor_final );
foreach ( $investor_final as $row ) {
// print_r($row);
$investor_download = '';
if ( $row[ 0 ] != '' && $row[ 1 ] != '' ) {
$count++;
//print_r($row[ 2 ]);
if ( $row[ 2 ] != '' ) {
$d = new DOMDocument();
$d->loadHTML( $row[ 2 ] );
$x = new DOMXpath( $d );
$file_title = $x->evaluate( '//span[contains(@class, "fcfile_title")]' );
$file_url = $x->evaluate( '//a[contains(@class, "fcfile_downloadFile")]' );
$investor_download = '';
if ( $file_title->length > 0 ) {
$file_title = $file_title->item( 0 )->nodeValue;
$file_url = $file_url->item( 0 )->getAttribute( 'href' );
$investor_download .= '<div class="grid gap-x-xl align-bottom justify-between border-top-dark pt-ph mt-p">';
$investor_download .= '<div class="col-content"><p>' . $file_title . '</p></div>';
$investor_download .= '<div class="col-content"><p><a href="' . $file_url . '" class=" button icon-left fcfile_downloadFile no-barba" title="' . JText::_( 'DOWNLOAD_TEXT' ) . '" target="_blank"><i class="icon icon-download"></i>' . JText::_( 'DOWNLOAD_LINK' ) . '</a></p></div>';
$investor_download .= '</div>';
}
}
$investor_body .= '<details>';
$investor_body .= '<summary>';
$investor_body .= '<h3>' . $row[ 0 ] . '</h3>';
$investor_body .= '</summary>';
$investor_body .= '<div class="p-all">';
$investor_body .= '<div class="aa">';
$investor_body .= $row[ 1 ];
$investor_body .= $investor_download;
$investor_body .= '</div>';
$investor_body .= '</div>';
$investor_body .= '</details>';
}
}
}
?>
<?php if ( isset( $investor_final ) ) :?>
<?php echo $investor_body;?>
<?php endif;?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment