Rich-text formatting in PHP: HTML, Markdown, rich-text editors like TinyMCE and doing it securely

Поділитися
Вставка
  • Опубліковано 14 жов 2024

КОМЕНТАРІ •

  • @ShubhamMishra-uw9yi
    @ShubhamMishra-uw9yi 3 роки тому +3

    You are born to be a teacher 🙏

  • @edwardbabatunde
    @edwardbabatunde 8 місяців тому

    Straight to the point. Very impressive. Thanks for sharing

  • @savanaassasinandy716
    @savanaassasinandy716 2 роки тому +1

    Thank you a million times over!!

  • @lianna5483
    @lianna5483 3 роки тому +3

    Thank you very much for this video ! It's cristal clear !

  • @SAIEN333
    @SAIEN333 8 місяців тому +1

    thank you, this was very easy to understand

  • @itsHan
    @itsHan 2 роки тому +1

    Thanks alot sir you really deserve 1m+ subs

  • @yazilimci_adam
    @yazilimci_adam Рік тому +1

    Thank you very much boss.

  • @malekfarag5134
    @malekfarag5134 3 роки тому +3

    This is awesome omg

  • @giantjam4918
    @giantjam4918 3 роки тому +3

    I was searching for adding this feature , thank you so much , Cant i add it using html and css only ? For adding it in an onion service ?

    • @dave-hollingworth
      @dave-hollingworth  3 роки тому +1

      You can use markdown with HTML only in the browser, but you do need to have a markdown parser on the server to process it into HTML. If you want a rich-text editor like TinyMCE, then I'm not aware of any that don't use JavaScript I'm afraid.

    • @giantjam4918
      @giantjam4918 3 роки тому +1

      @@dave-hollingworth thank you brilliant

  • @belowsurfacemedia
    @belowsurfacemedia 2 роки тому

    love this! most relaxed tutorial ever :D

  • @MT-ox3gz
    @MT-ox3gz 3 роки тому +1

    Thank you very much

  • @BlueDolphinBlues
    @BlueDolphinBlues Рік тому

    Thanks, this is very helpful. What about stripping php?

    • @dave-hollingworth
      @dave-hollingworth  Рік тому

      Any PHP code wouldn't be executed as it would be sent to the browser - you could strip it using a regular expression though if you wanted

    • @BlueDolphinBlues
      @BlueDolphinBlues Рік тому

      @@dave-hollingworth in my application the posted data would be stored and then presented as a blog. I want to give the user some ability to script without allowing them to return any session variables or information about the host.

    • @dave-hollingworth
      @dave-hollingworth  Рік тому

      @@BlueDolphinBlues I'd be hesitant about giving the user script abilities - you'd have to parse the code to make sure there wasn't anything unexpected in there, which I think would be very difficult to make sure it was safe. I'm not aware of any parsers like the HTML one that allow you to strip code from PHP code. Alternatively, you could use a templating engine like Twig or something like Markdown that allow additional functionality but don't expose PHP to the user.

    • @BlueDolphinBlues
      @BlueDolphinBlues Рік тому +1

      @@dave-hollingworth I completely agree.

  • @sumanparajuli229
    @sumanparajuli229 3 роки тому +2

    Sir create a video on.. medication tracker and notification on given timeframe with php...

    • @dave-hollingworth
      @dave-hollingworth  3 роки тому

      Always looking for video ideas - please could you be a bit more specific? I tend to prefer videos that explain a single topic, so for example "how to send notifications using SMS" for example. If you can suggest simple topics like that I'll be happy to consider a video on it! Thanks

  • @g7k993
    @g7k993 3 роки тому

    Hey Dave thank you for the video. Quick question that’s bugging me, what’s the difference between htmlspecialchars(), htmlentities and the html purifier you’ve used?
    Future video ideas: I’m not sure if you have any small crud app in your playlist ( binge watching it rn).
    For example: “ Hotel booking system, car rental crud app or restaurant online ordering ) simple page with just a table, search form and a picture to explain how crud works. The secrete being “real life application”. That sort of videos appeal to many different audience.

    • @dave-hollingworth
      @dave-hollingworth  3 роки тому

      Basically htmlspecialchars is for when you want to escape something to display it in HTML. HTML purifier is used to remove unwanted tags and attributes completely. There's a good description here: learnwebtutorials.com/difference-between-htmlentities-and-htmlspecialchars-in-php
      I don't have a CRUD series right now but that's a good idea, I'll make a note of it!

  • @ademineshat
    @ademineshat 3 роки тому

    Nice one 👌

  • @pablokaram6342
    @pablokaram6342 2 роки тому

    Hi Dave!, im using twig and i notice that automatically resolve the issue with the HTML special chars, (with the | raw) incidator actived, however if i change the style attribute directly in the strong tag, it doesn't purify and appears red, my question is, how can i use the purifier library with twig, of it exists some solution with the twig templates?

    • @dave-hollingworth
      @dave-hollingworth  2 роки тому

      There's a package here that might help: github.com/Exercise/HTMLPurifierBundle

  • @kribo9604
    @kribo9604 2 роки тому

    Why composer ???

    • @dave-hollingworth
      @dave-hollingworth  2 роки тому +1

      Composer is the easiest way to install third-party packages and their dependencies into a PHP project