Composer Write Conflicting w/ Block

Permalink
Hello,

I am curious if there is a way to have the composer write page adhere to the code that renders blocks disabled in edit mode or similar. My problem is trying to add forms, such as driving directions, to composer and publish them. I believe the forms inside the main composer form are conflicting, making publishing impossible.

Thank you in advance for any suggestions.

 
ericchaffey replied on at Permalink Reply
Well, so far it appears I found a fix, until something breaks. I am sure there is a better way of doing it, but this seems like it will get me by until someone much smarter than me points out a better way.

Here is my fix for any curious people:

I created a file in the libraries folder (not concrete/libraries) called geturl.php and put this in there:

<?php defined('C5_EXECUTE') or die("Access Denied.");
function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}


I then added this to the top of all my pages that have been wreaking havok with Composer

<?php  defined('C5_EXECUTE') or die("Access Denied."); 
 Loader::library('geturl'); 
if (preg_match('#^http://mysiteurl.com/myconcretefolder/index.php/dashboard/composer/write/edit/[^&]*#', curPageURL())) {
   echo "Content disabled in composer.";
 }else {
?>


On issue I have found is after editing the disabled areas they will pop back up, but so far I have been able to publish with no issues except one so far. If there is an error, for example I do not add a name, the page will refresh and everything will be a mess again.

So while it is far from a perfect fix, it's a nifty little band-aid that is getting me by for now, and can hopefully help someone else out as well.
foiseworth replied on at Permalink Reply
foiseworth
Hi ericchaffey,

Came across the same problem today on 5.5 and developed the below fix:

<?php if (!$c->isEditMode() && !strpos($c->cFilename, 'dashboard/composer')): ?>
   <!-- Conditional code goes here -->
<?php endif; ?>