• Login
Community
  • Login

PHP instead <?php and php> {PHP} and {/PHP}

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
phplanguagebeginning
7 Posts 3 Posters 489 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.
  • S
    sunshinebard
    last edited by May 3, 2024, 2:36 PM

    I really have trouble to find out the following:

    I would like the exact same Language for php, but since I use a speacial programm, I need
    {PHP} and {/PHP}
    instead of
    <?php and php>

    can someone create an xml for this please?
    (I can’t find the xml for php that I can build it on.)

    P 1 Reply Last reply May 3, 2024, 5:51 PM Reply Quote 1
    • P
      PeterJones @sunshinebard
      last edited by May 3, 2024, 5:51 PM

      @sunshinebard ,

      I can’t find the xml for php that I can build it on

      The built-in lexers (like PHP) are separate from the User Defined Language lexing , so there is no such creature to find – there is no way to start a UDL based on the settings for a built-in lexer.

      You either need to code a new lexer or lexer plugin, or update the PHP lexer coding and recompile, or create a new UDL from scratch. The last option seems your best choice, though because UDL isn’t as powerful as a true built-in or plugin lexer, you’ll probably be somewhat disappointed in the results.

      1 Reply Last reply Reply Quote 2
      • S
        sunshinebard
        last edited by May 4, 2024, 6:13 AM

        Thank you!
        do you know if there already is a php based UDL that I can modify slightly with this beginning {PHP} and ending {/PHP}?
        i have trouble finding it here:
        github com/notepad-plus-plus/userDefinedLanguages/blob/master/UDLs/Geomatica_EASI_byPhilippeCote.xml (missing 1 rep to send links)

        compiling new sounds pretty hard for a newby like me.

        P 1 Reply Last reply May 4, 2024, 5:09 PM Reply Quote 1
        • P
          PeterJones @sunshinebard
          last edited by May 4, 2024, 5:09 PM

          @sunshinebard said in PHP instead <?php and php> {PHP} and {/PHP}:

          do you know if there already is a php based UDL that I can modify slightly with this beginning {PHP} and ending {/PHP}?
          i have trouble finding it here:

          The User Defined Language (UDL) collection does not appear to have a PHP UDL. Most of the time, people don’t bother creating a UDL for a language that Notepad++ handles natively, unless they find something that doesn’t quite meet their needs. (But given how few are published to replace existing lexers, I think they also discover that the limitations of UDL outweigh the missing aspects of the built-in lexer, so don’t bother sharing it. And most of the ones that do exist were actually made before Notepad++ added native support for that language.)

          (missing 1 rep to send links)

          I’ve upvoted you now, so that limitation is gone.

          compiling new sounds pretty hard for a newby like me.

          Well, yes, compiling it yourself isn’t for the faint of heart. I was trying to steer you toward making your own UDL, because making a simple UDL is actually really easy: just put a few keywords in the “Define Your Language” dialog.

          If you do create a UDL for PHP, or for your modified PHP, feel free to share it in the Collection.

          But really, if the only difference in your language is that it uses {PHP} and {/PHP} , you could probably just use the EnhanceAnyLexer plugin to enhance the PHP-lexer to highlight 0x123456 = {/?PHP} (where 0x123456 is the 0xGGBBRR color code you want to use for that.)

          S 1 Reply Last reply May 5, 2024, 9:31 AM Reply Quote 5
          • S
            sunshinebard @PeterJones
            last edited by May 5, 2024, 9:31 AM

            @PeterJones
            I installed it. do you know how I can achieve that screenshot 1 will look like screenshot 2
            just coloring it won’t work I’m afraid

            Screenshot 2024-05-05 112750.png

            Screenshot 2024-05-05 112837.png

            btw: thank you very much for your help so far!

            E 1 Reply Last reply May 7, 2024, 7:01 AM Reply Quote 0
            • E
              Ekopalypse @sunshinebard
              last edited by May 7, 2024, 7:01 AM

              @sunshinebard

              I’m afraid that doesn’t seem to be possible, as < seems to be a critical part for the php/html/xml lexer.
              It looks like you need to create a UDL yourself.

              S 1 Reply Last reply May 8, 2024, 12:57 PM Reply Quote 1
              • S
                sunshinebard @Ekopalypse
                last edited by May 8, 2024, 12:57 PM

                @Ekopalypse
                Thank you for your help! what a pitty. (right now it is easier to just copy the code in between the working <php …)

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