How to add custom HTML element to code.php

Hi Admin,


I creates custom css for code.php in 6.0.12 version
I added '<div class="outer"><div class="code">' element.


code.php


<?php

echo    '<ignore><!--notypo-->' .
            '<div class="outer"><div class="code">' .
                Ut::html($text) .
            '</div></div>' .
        '<!--/notypo--></ignore>';

After upgrade to 6.0.37 it's not work because the code has changed.


<?php

$tpl->text = Ut::html($text);

How to add '<div class="outer"><div class="code">' element to code.php in 6.0.37 version?


https://ibb.co.com/ngDnx1B


Thank you.

Comments

  1. Re: How to add custom HTML element to code.php

    If you see $tpl->, it uses a template, just look out for the subfolder named template/ and the corresponding.tpl template file. Change the HTML code there.


    Or copy and rename both files and create a custom formatter which gets not overwritten with the next update, kinda %%(my_code) ... %% using the name of the file.

    How templates work you'll find in the template guide.
    • WikiAdmin
    • 17.12.2024 07:18 edited
  2. Re: How to add custom HTML element to code.php

    Thank you Admin.

    I tried to change

    [ === main === ]
    <ignore>
    <!--notypo-->
    	<pre class="code">
    		[ ' text | pre ' ]
    	</pre>
    <!--/notypo-->
    </ignore>	


    to 

    [ === main === ]
    <ignore>
    <!--notypo-->
    	<div class="outer">
    		<div class="code">
    			[ ' text | pre ' ]
    		</div>
    	</div>
    <!--/notypo-->
    </ignore>	


    but still not working
  3. Re: How to add custom HTML element to code.php

    Looks good.

    Not working in what way?
    Not working at all or still uses the previous syntax?

    Use LF not CRLF line endings in WackoWiki templates.

    You have to reparse the page, e.g. edit it again or empty body_r, a formatter is not dynamic like an action.
    Once it is parsed the result is stored in the body_r field in the page table.

    Did you tried to do a small change and save it again.
    And purged the old cache on the server as well the browser.

    When it still uses the previous version maybe you edited the wrong file (in the wrong instance) or updated the wrong file on the server. The template is the only source for the formatter.
    • WikiAdmin
    • 17.12.2024 11:09 edited
Log in or create an account to post a comment.