Skip to main content
Participant
October 16, 2019
Question

Heredoc and Adobe Dreamweaver 2019 CC vol.2

  • October 16, 2019
  • 1 reply
  • 805 views

Hi to all!

 

I'm writing this as a follow-up to my previous thread on the topic (Heredoc and Adobe Dreamweaver 2019 CC) that got lost during the forum's migration to the new platform.

 

So the last important reply there was made from @Paul-M , "promising" to have a look at my problem and maybe come up with a solution! So Paul did you have a chance to maybe take a look on this?

    This topic has been closed for replies.

    1 reply

    Legend
    October 17, 2019

    Can you send a a few code snippet examples please

    Paul-M - Community Expert
    kalpet79Author
    Participant
    October 18, 2019

    In Dreamweaver CS 5.5, after putting the appropriate code in C:>Program Files>Adobe>Adobe Dreamweaver CC 2015>Configuration>CodeColoring>PHP.xml, you could get HTML code inside a PHP Heredoc parsed (and colored) as HTML. Ie the image below:

     

    In Dreamweaver CC 2019, HTML in PHP Heredoc is parsed as simple text, and only PHP vars are parsed (and colored) appropriately. Ie the image below (see how HTML is just in yelow and vars inside the curly brackets are colored as PHP):

     

    Whereas normal HTML is colored differently:

     

    The code sample shown in the two version of DW is the following:

     

     

    		// In case of only one option, the interface sends an object instead of an array
    		if (is_object($group->optionList)) {
    			// So first check if the option is valid, otherwise skip it
    			if (!isset($group->optionList->optionTranslations) or $group->optionList->optionTranslations == '~empty_key~' or preg_match('/_no_property$/', $group->optionList->optionName)) {
    				continue;
    			}
    
    			// And then convert the object into an array
    			$group->optionList = array(
    				$group->optionList
    			);
    		}
    
    		$translated = translate($group->selectName);
    
    		echo <<<END
              <div class="card">
                <div class="card-header" id="heading{$group->selectId}">
                  <h2 class="mb-0">
                    <button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#collapse{$group->selectId}" aria-expanded="false" aria-controls="collapse{$group->selectId}">{$translated}</button>
                    <div class="spinner-border spinner-border-sm text-secondary" role="status"><span class="sr-only">Loading...</span></div>
                    <i class="fa fa-code pull-right" data-toggle="popover" data-container="body" data-placement="left" data-html="true" data-content="{$tooltip}"></i>
                  </h2>
                </div>
                <div class="collapse" id="collapse{$group->selectId}" data-parent="#apiResponse" aria-labelledby="heading{$group->selectId}">
                  <div class="card-body">
                    <div class="list-group list-group-flush">
    END;
    
    		foreach ($group->optionList as $option) {
    			// Translation texts consisting of...
    			switch (gettype($option->optionTranslations)) {

     

     

    Fun fact I realized after pasting my code in the code box above: Even this code box of this WYSIWYG editor parses the HTML code inside the PHP Heredoc correctly, and DW CC 2019 cannot!

     

    EDIT: Once I submitted my Reply, the code in the code box got colored in black, but while in Edit mode, it gets colored correctly:

    Legend
    October 19, 2019

    I coldn't find a solution for this - not possible to get html code colouring inside heredoc as far as I could see, as you already pointed out, its treated like a string and only vars are coloured

    Paul-M - Community Expert