Community
    • Login

    How to add custom HTML Fold when Language = PHP?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    html custom fol
    6 Posts 3 Posters 2.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Will S.W
      Will S.
      last edited by

      How can I define custom folding sections in HTML when coding in PHP and HTML with Language set to equal PHP?

      I can create custom PHP folds by creating multiple PHP sections…

      <?php // fold 1
      …some php code
      ?>
      <?php // fold 2
      …more php code
      ?>

      BUT I have sections of pure HTML scattered through out and would like a way to add a custom…
      Start HTML Fold 1
      …some html code
      End HTML Fold

      I do not want to create an entire custom language… so is there any trick that I can use to define custom folds or sections of html code?

      BTW using html <section></section> does not seem work
      Thanks for any help.

      Claudia FrankC 1 Reply Last reply Reply Quote 0
      • Claudia FrankC
        Claudia Frank @Will S.
        last edited by

        @Will-S

        Cheers
        Claudia

        1 Reply Last reply Reply Quote 0
        • guy038G
          guy038
          last edited by

          Hello, @will-s, @claudia-frank, and All

          No problem, too !

          <?php // fold 1
          …some php code
          ?>
          <?php // fold 2
          …more php code
          ?>
          
          <section>
            Me, too ! Speaking of @will-s problem, exclusively, of course ;-))
          </section>
          
          // Notepad++ v7.5.1   (32-bit)
          // Build time : Aug 29 2017 - 02:35:41
          // Path : C:\_751\notepad++.exe
          // Admin mode : OFF
          // Local Conf mode : ON
          // OS : Windows XP (32-bit)
          // Plugins : ComparePlugin_2.0.dll DSpellCheck.dll mimeTools.dll NppAutoIndent.dll NppConverter.dll NppExport.dll
          

          Best Regards,

          guy038

          1 Reply Last reply Reply Quote 0
          • Will S.W
            Will S.
            last edited by

            <section> works but gets confused if you try and create a section that includes only part of a large table… or placed inside a <tr> like this poor example where one may attempt to clump all the code at the bottom into a single fold… as in this poor example.
            (yes, if you put the <section> tag before the <tr> in the example it works better but the actual cases may be a lot more complicated than this.)

            !DOCTYPE html>
            <html>
            <body>

            <table>

            <tr>
            <th>Page Header Left Cell</th>
            <th>Page Header Center Cell</th> 
            <th>Page Header Right Cell</th>
            

            </tr>

            <tr>
            <td>Main Body Left Cell</td>
            <td>Main Body Center Cell

            </td>
            <td>Main Body Right Cell</td>
            

            </tr>

            <tr>
            <section> <!-- Bottom Section of Page Start–>
            <td>Page Footer Left Cell</td>
            <td>Page Footer Center Cell
            </td>
            <td>Page Footer Right Cell</td>
            </tr>

            </tr>
            </table>
            </section> <!-- Bottom Section of Page Ends -->
            </body>
            </html>

            1 Reply Last reply Reply Quote 0
            • guy038G
              guy038
              last edited by

              Hi, @will-s,

              I do not code in HTML, nor PHP , but, logically, in your example, some tags do not seem correctly nested !? Hence, possible folding problems ?

              Your example test is :

              < !DOCTYPE html>
              <html>
              <body>
              
              <table>
              
              	<tr>
                  <th>Page Header Left Cell</th>
                  <th>Page Header Center Cell</th> 
                  <th>Page Header Right Cell</th>
                </tr>
              
                <tr>
                  <td>Main Body Left Cell</td>
                  <td>Main Body Center Cell
              	
              	</td>
                  <td>Main Body Right Cell</td>
                </tr>
              
                <tr>
                  <section> <!-- Bottom Section of Page Start-->
                  <td>Page Footer Left Cell</td>
                  <td>Page Footer Center Cell	
              	</td>
                  <td>Page Footer Right Cell</td>
                </tr>
               
                </tr>
              </table>
              </section> <!-- Bottom Section of Page Ends -->
              </body>
              </html>
              

              I, personally, would have written the following text :

              < !DOCTYPE html>
              <html>
                <body>
              
                  <table>
              
                    <tr>
                      <th>Page Header Left Cell</th>
                      <th>Page Header Center Cell</th> 
                      <th>Page Header Right Cell</th>
                    </tr>
              
                    <tr>
                      <td>Main Body Left Cell</td>
                      <td>Main Body Center Cell
              
                      </td>
                      <td>Main Body Right Cell</td>
                    </tr>
              
                    <tr>
                      <section> <!-- Bottom Section of Page Start-->
                        <td>Page Footer Left Cell</td>
                        <td>Page Footer Center Cell	
                        </td>
                        <td>Page Footer Right Cell</td>
                      </section> <!-- Bottom Section of Page Ends -->
                    </tr>
              
                  </table>
                </body>
              </html>
              

              Probably, people coding in HTML / PHP, will provide you better hints than myself :-))

              Cheers,

              guy038

              1 Reply Last reply Reply Quote 0
              • Will S.W
                Will S.
                last edited by

                Here is the answer… (unless someone tells me it creaes another a problem…)

                The "echo’ command can include multiple lines as the simple example below illustrates.
                Note the single quote mark brackets the echo’d code since double quote marks are used within the echo’d code at various points…

                So for me this example code folds perfectly and in my real case actually runs :-)

                If anybody sees a problem with using the multiple line php echo to manage folds in mixed html and php code please let me know.

                Example: (To try it paste it into Notepad ++ and select PHP as the language)

                <?php // TABLE 1 – ROW 1 – DISPLAY PAGE HEADER – THEN DISPLAY DATA INPUT FORM
                echo ’
                <table style=“width: 1233px; height: 595px; text-align: left; margin-left: auto; margin-right: auto;” border=“1” cellpadding=“2” cellspacing=“2”>
                <tbody>
                <tr>
                <td style=“vertical-align: top; width: 150px; text-align: center;”>
                </td>
                <td style=“vertical-align: top;”>
                ';
                $page_name = “mypage.php”;
                include ‘inc_header.php’;
                echo ’
                </td>
                <td Style=“vertical-align: top; width: 150px;”>
                </td> <!-- t1 tr1 td3 -->
                </tr>
                ';
                ?>

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                The Community of users of the Notepad++ text editor.
                Powered by NodeBB | Contributors