Block breaking stack page
Permalink
October 17, 2012 at 2:46 AM
I have tried editing the page_list block where it gets an multiple select attribute from the database to the page.
This works fine in the front end and the page list displays correctly.
But when I go to the Dashboard and edit the stack, it breaks the Stack page. The source code for the page is not complete and it shows only white page with a few links.
I'm currently using the following template code.
<?php
defined ( 'C5_EXECUTE' ) or die ( "Access Denied." ) ;
$th = Loader:: helper ( 'text' ) ;
$db = Loader:: db ( ) ;
?>
<div id="article-list">
<?php
foreach ( $cArray as $cobj ) :
$title = $cobj -> getCollectionName ( ) ;
$description = $cobj -> getCollectionDescription ( ) ;
$description = $controller -> truncateSummaries ? $th -> shorten ( $description , $controller -> truncateChars ) : $description ;
$description = $th -> entities ( $description ) ;
$date = $cobj -> getAttribute ( 'julkaistu' ) ;
$author = $cobj -> getVersionObject ( ) -> getVersionAuthorUserName ( ) ;
$link = $nh -> getLinkToCollection ( $cobj ) ;
<?php
defined ( 'C5_EXECUTE' ) or die ( "Access Denied." ) ;
$th = Loader:: helper ( 'text' ) ;
$db = Loader:: db ( ) ;
?>
<div id="article-list">
<?php
foreach ( $cArray as $cobj ) :
$title = $cobj -> getCollectionName ( ) ;
$description = $cobj -> getCollectionDescription ( ) ;
$description = $controller -> truncateSummaries ? $th -> shorten ( $description , $controller -> truncateChars ) : $description ;
$description = $th -> entities ( $description ) ;
$date = $cobj -> getAttribute ( 'julkaistu' ) ;
$author = $cobj -> getVersionObject ( ) -> getVersionAuthorUserName ( ) ;
$link = $nh -> getLinkToCollection ( $cobj ) ;
$entryController = Loader:: controller ( $cobj ) ;
?>
<div class="article">
<h3>
<a href="<?php echo $link ; ?> "><?php echo $title ; ?> </a>
</h3>
<p class="article-list-category">
<?php
unset ( $myValues ) ;
unset ( $myValues2 ) ;
$r = $db -> query ( "SELECT distinct ak_painoala FROM CollectionSearchIndexAttributes where cID='" . $cobj -> getCollectionID ( ) . "'" ) ;
$myValues = array ( ) ;
while ( $row = $r -> fetchRow ( ) ) {
//search for multiple values
$myValues = explode ( "\n " , $row [ 'ak_painoala' ] ) ;
}
$myValues = array_filter ( $myValues ) ;
$myValues = array_unique ( $myValues ) ;
foreach ( $myValues as $row ) {
// käydään arvot läpi yksitellen
$myValues2 [ ] = "<a href='http://www.oamk.fi/epooki2012/" . toAscii( $row ) . "/'>" . $row . "</a>" ;
}
$myValues = implode ( ", " , $myValues2 ) ;
echo $myValues ;
?>
:: <span class="article-list-date"><?php echo date ( 'd.m.Y' , strtotime ( $date ) ) ; ?> </span></p>
<p><?php echo $description ; ?> </p>
</div>
<hr class="article-list-divider"/>
<?php endforeach ; ?>
</div>
<?php if ( $paginate && $num > 0 && is_object ( $pl ) ) : ?>
<div id="article-pagination">
<?php
$summary = $pl -> getSummary ( ) ;
if ( $summary -> pages > 1 ) :
$paginator = $pl -> getPagination ( ) ;
?>
<span class="pagination-left"><?php echo $paginator -> getNext ( '« Edelliset' ) ; ?> </span>
<?php #echo $paginator->getPages(); ?>
<span class="pagination-right"><?php echo $paginator -> getPrevious ( 'Seuraavat »' ) ; ?> </span>
<?php endif ; ?>
</div>
<?php endif ; ?>
And this results in the following code in the Dashboard:
< script type= "text/javascript" >
ccm_stacksAddBlock = function ( ) {
ccm_openAreaAddBlock( "Main" , true , 192 ) ;
}
ccm_parseBlockResponsePost = function ( r) {
if ( r. task != 'update_groups' ) {
$( ".ccm-main-nav-edit-option" ) . fadeIn( 300 ) ;
}
}
$( function ( ) {
CCM_EDIT_MODE = true ; // override header_required
ccm_editInit( ) ;
$( "#stackPermissions" ) . dialog( ) ;
$( "#stackVersions" ) . dialog( ) ;
} ) ;
< script type= "text/javascript" >
ccm_stacksAddBlock = function ( ) {
ccm_openAreaAddBlock( "Main" , true , 192 ) ;
}
ccm_parseBlockResponsePost = function ( r) {
if ( r. task != 'update_groups' ) {
$( ".ccm-main-nav-edit-option" ) . fadeIn( 300 ) ;
}
}
$( function ( ) {
CCM_EDIT_MODE = true ; // override header_required
ccm_editInit( ) ;
$( "#stackPermissions" ) . dialog( ) ;
$( "#stackVersions" ) . dialog( ) ;
} ) ;
</script>
< style type= "text/css" >
div. ccm- block { border: 2px dotted #efefef; clear: both; overflow: hidden; margin: 0px 0px 4px 0px; padding: 2px}
</ style>
< div class = "ccm-ui" >< div class = "row" >< div class = "span10 offset1" >< div class = "ccm-pane" >< div class = "ccm-pane-header" >< ul class = "ccm-pane-header-icons" >< li>< a href= "" class = "ccm-icon-navigate-pages" data- toggle= "dropdown" title= "Pinot ja lohkot" id= "ccm-page-navigate-pages" > Ohje</ a>< ul id= "ccm-page-navigate-pages-content" class = "dropdown-menu" >< li class = "nav-selected" >< a href= "/epooki2012/index.php/dashboard/blocks/stacks/" > Pinot</ a></ li>< li class = "" >< a href= "/epooki2012/index.php/dashboard/blocks/types/" > Lohkotyypit</ a></ li>< li class = "" >< a href= "/epooki2012/index.php/dashboard/blocks/designer_content/" > Designer Content</ a></ li>< li class = "" >< a href= "/epooki2012/index.php/dashboard/blocks/permissions/" > Lohkojen ja pinojen oikeudet</ a></ li>< li class = "ccm-menu-separator" ></ li>< li>< a href= "/epooki2012/index.php/dashboard/" >< Takaisin kohtaan Hallintapaneeli</ a></ li></ ul></ li>< li>< span style= "display: none" id= "ccm-page-help-content" > Pinot ovat lohkoryhmiä, ja ne helpottavat sisältöjen uudelleenkäyttämistä useammalla sivulla. Pinoja muokataan ja ylläpidetään Hallintapaneelissa, jonka jälkeen ne sijoitetaan yksittäisille sivuille tai lisätään sivutyypin oletuksiin. Lohkojen sisältöä ja järjestystä voidaan hallita sekä palata myös aiempiin pinon versioihin.</ span>< a href= "javascript:void(0)" class = "ccm-icon-help" title= "Ohje" id= "ccm-page-help" > Ohje</ a></ li>< li>< a href= "javascript:void(0)" id= "ccm-add-to-quick-nav" onclick= "ccm_toggleQuickNav(36,'1350456297:d82b414de055fad1d248a1fc70eeae05')" class = "ccm-icon-favorite" > Lisää suosikkeihin</ a></ li>< li>< a href= "javascript:void(0)" onclick= "ccm_closeDashboardPane(this)" class = "ccm-icon-close" > Sulje</ a></ li></ ul>< h3> Navigation</ h3></ div> < div class = "ccm-pane-options" >
< a href= "javascript:void(0)" onclick= "ccm_stacksAddBlock()" class = "btn small ccm-main-nav-edit-option" > Lisää lohko</ a>
< a class = "btn small ccm-main-nav-edit-option" dialog- width= "640" dialog- height= "340" id= "stackVersions" dialog- title= "Versiohistoria" href= "/epooki2012/index.php/tools/required/versions.php?rel=SITEMAP&cID=192" > Versiohistoria</ a>
< a class = "btn ccm-button-v2-right small ccm-main-nav-edit-option error" href= "javascript:void(0)" onclick= "if (confirm('Oletko varma, että haluat poistaa tämän pinon?')) { window.location.href='/epooki2012/index.php/dashboard/blocks/stacks/delete/192/1350456297:92b0d92cebec86d36362b821db39f84f/' }" > Poista pino</ a>
< a style= "margin-right: 8px; display: none; href=" javascript: void( 0 ) " onclick=" window. location. href= '/epooki2012/index.php?cID=192&ctask=approve-recent&ccm_token=1350456297:41f64302dc68f69131ba272ac39b9f22' " class=" btn small ccm- main- nav- edit- option ccm- button- v2- right">Hyväksy muutokset</a>
</div>
<div class=" ccm- pane- body ccm- pane- body- footer clearfix" id=" ccm- stack- container">
<div id=" a159" cID=" 192 " handle=" Main" class=" ccm- area ccm- area- move- enabled">
<script type=" text/ javascript">
$(function() {
var ccm_menuObj1036159 = {};
ccm_menuObj1036159.type = " BLOCK";
ccm_menuObj1036159.arHandle = 'Main';
ccm_menuObj1036159.aID = 159;
ccm_menuObj1036159.bID = 1036;
ccm_menuObj1036159.cID = 192;
ccm_menuObj1036159.canWrite =true;
ccm_menuObj1036159.hasEditDialog = true;
ccm_menuObj1036159.btName = " Page List ";
ccm_menuObj1036159.width = 500;
ccm_menuObj1036159.height = 370;
ccm_menuObj1036159.canCopyToScrapbook = true;
ccm_menuObj1036159.canDesign = true;
ccm_menuObj1036159.canEditBlockCustomTemplate = true;
ccm_menuObj1036159.canAdmin = true;
ccm_menuObj1036159.canDelete = true;
ccm_menuObj1036159.deleteMessage = " Haluatko poistaa tämän lohkon?";
ccm_menuObj1036159.canArrange = true;
ccm_menuInit(ccm_menuObj1036159);
});
</script>
<div id=" b1036- 159 " custom-style=" 0 " class=" ccm- block"><div id=" article- list ">
<div class=" article">
<h3>
<a href=" / epooki2012/ terveys- ja- hyvinvointi/ oppia- ja- huvia- digitaalisista- hyvinvointipeleista/ ">Oppia ja huvia digitaalisista hyvinvointipeleistä</a>
</h3>
<p class=" article- list- category">
What could cause this?
I was missing the toAscii function from the template.
The function was in the page but not in the dashboard.