Development

#2188 (Add content to a slot - useful for 'embed' component)

You must first sign up to be able to contribute.

Ticket #2188 (new enhancement)

Opened 2 years ago

Last modified 1 year ago

Add content to a slot - useful for 'embed' component

Reported by: cristianbaciu Assigned to: cristianbaciu
Priority: minor Milestone:
Component: sfSimpleCMSPlugin Version: 1.0.0
Keywords: Cc:
Qualification: Unreviewed

Description

Add this helper's in sfSimpleCMSHelper.php

function sf_simple_cms_to_slot($slot)
{
  $inplace = sfContext::getInstance()->getRequest()->getParameter('inplace');
  $edit = sfContext::getInstance()->getRequest()->getParameter('edit');
  if($edit && $inplace){
    return slot($slot);
  }
  elseif ($edit){
    return '';
  }
  else {
    return slot($slot);
  }
}

function sf_simple_cms_end_to_slot()
{
  $inplace = sfContext::getInstance()->getRequest()->getParameter('inplace');
  $edit = sfContext::getInstance()->getRequest()->getParameter('edit');
  if($edit && $inplace){
    return end_slot();
  }
  elseif ($edit){
    return '';
  }
  else {
    return end_slot();
  }

}

Usage example:

<?php  use_helper('sfSimpleCMS','Partial', 'Cache', 'Form', 'I18N') ?>

<?php sf_simple_cms_to_slot('SLOT_NAME_IN_MODULE') ?>
  <?php sf_simple_cms_slot($page, 'thx-page', '[cms_thx-msg]') ?> 
<?php sf_simple_cms_end_to_slot(); ?> 

<?php include_editor_tools($page) ?> 

In edit mode if we add &inplace=true to the url we can edit the content of the slot right there where it is.

Change History

09/05/07 10:02:42 changed by cristianbaciu

  • owner changed from fabien to francois.
  • component changed from other to sfSimpleCMSPlugin.

11/26/07 18:19:38 changed by Emiliano.Gabrielli

  • qualification set to Unreviewed.

I think you can simplify in:

function sf_simple_cms_to_slot($slot)
{
  $inplace = sfContext::getInstance()->getRequest()->getParameter('inplace');
  $edit = sfContext::getInstance()->getRequest()->getParameter('edit');
  if($edit && !$inplace){
    return '';
  }
  else {
    return slot($slot);
  }
}

02/25/08 11:15:17 changed by francois

  • owner changed from francois to cristianbaciu.

I simply don't understand what you are trying to do. Could you explain me the feature, the process and the benefits of your change ?

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.