Author: Jonathan.Wage
Date: 2010-01-11 01:18:00 +0100 (Mon, 11 Jan 2010)
New Revision: 26465

Modified:
   
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalFrontendEditorPlugin/modules/sympal_editor/templates/linksSuccess.php
Log:
[1.4][sfSympalPlugin][1.0] Fixing fatal error when no content exists


Modified: 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalFrontendEditorPlugin/modules/sympal_editor/templates/linksSuccess.php
===================================================================
--- 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalFrontendEditorPlugin/modules/sympal_editor/templates/linksSuccess.php
      2010-01-11 00:09:00 UTC (rev 26464)
+++ 
plugins/sfSympalPlugin/trunk/lib/plugins/sfSympalFrontendEditorPlugin/modules/sympal_editor/templates/linksSuccess.php
      2010-01-11 00:18:00 UTC (rev 26465)
@@ -32,28 +32,33 @@
   <div id="links">
     <h2><?php echo $contentType->getLabel() ?> Links</h2>
     <ul>
-      <?php $menuItem = $content->getFirst()->getMenuItem() ?>
-      <?php if ($menuItem && $parentMenuNode = 
sfSympalMenuSiteManager::getMenu('primary')->findMenuItem($menuItem)->getParent()):
 ?>
-        <li>
-          <?php echo image_tag('/sfSympalPlugin/images/folder.png') ?>
-          <?php echo link_to($parentMenuNode->getMenuItem()->getLabel(), 
$parentMenuNode->getMenuItem()->getItemRoute()) ?>
-        </li>
-      <?php endif; ?>
+      <?php if ($content->count()): ?>
 
-      <?php foreach ($content as $c): ?>
-        <?php $menuItem = $c->getMenuItem() ?>
-        <li id="<?php echo $c->getId() ?>"<?php if ($menuItem): ?> 
style="margin-left: <?php echo ($menuItem->getLevel() - ($parentMenuNode ? 
$parentMenuNode->getLevel() : 1)) * 15 ?>px;"<?php endif; ?>>
-          <?php if (!$menuItem || $menuItem->getNode()->isLeaf()): ?>
-            <?php echo image_tag('/sfSympalPlugin/images/page.png') ?>
-          <?php else: ?>
+        <?php $menuItem = $content[0]->getMenuItem() ?>
+        <?php if ($menuItem && $parentMenuNode = 
sfSympalMenuSiteManager::getMenu('primary')->findMenuItem($menuItem)->getParent()):
 ?>
+          <li>
             <?php echo image_tag('/sfSympalPlugin/images/folder.png') ?>
-          <?php endif; ?>
+            <?php echo link_to($parentMenuNode->getMenuItem()->getLabel(), 
$parentMenuNode->getMenuItem()->getItemRoute()) ?>
+          </li>
+        <?php endif; ?>
 
-          <a href="#link"><?php echo $c ?></a>
-        </li>
-      <?php endforeach; ?>
+        <?php foreach ($content as $c): ?>
+          <?php $menuItem = $c->getMenuItem() ?>
+          <li id="<?php echo $c->getId() ?>"<?php if ($menuItem): ?> 
style="margin-left: <?php echo ($menuItem->getLevel() - ($parentMenuNode ? 
$parentMenuNode->getLevel() : 1)) * 15 ?>px;"<?php endif; ?>>
+            <?php if (!$menuItem || $menuItem->getNode()->isLeaf()): ?>
+              <?php echo image_tag('/sfSympalPlugin/images/page.png') ?>
+            <?php else: ?>
+              <?php echo image_tag('/sfSympalPlugin/images/folder.png') ?>
+            <?php endif; ?>
+
+            <a href="#link"><?php echo $c ?></a>
+          </li>
+        <?php endforeach; ?>
+      <?php else: ?>
+        <?php echo __('Nothing found') ?>
+      <?php endif; ?>
     </ul>
   </div>
-  
+
   <a class="sympal_close_menu">close</a>
 </div>
\ No newline at end of file

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.


Reply via email to