resolved Jumi code is replaced when re-editing an article in Joomla - php

I did following in order to include php code into Joomla:
writing a php application with jumi as:
<?php echo '<p>Hallo Welt</p>'; ?>
include following code in the target article, where the previous code should be included:
{jumi [*1]}
this worked so far.
But, when i try to edit the article again using the wyiwyg editor, the editor take the resolved formatting, means Hallo Welt and the original code get replaced {jumi [*1]}
this is get very problematic when the code is dynamic!
does somebody has a solution for this issue or am I missing something?

No It's a common problem, no worries.
There are several hack you can do to avoid this.
Save the text in one file and every time edit the file and after copy and paste in Joomla.
When you edit the file, just edit from the source.
Use an alternative editor which is already in source mode like RokPad
Check Plugin Manager > Editor - TinyMCE > Entity Encoding = raw

Using sourcerer plugging for including php script into an article, does not cause this overriding of source code by the displayed result, that's why I was forced to stop using jumi in favor of sourcerer.
Switching to raw mode is unfortunately not an option, since this would increase the effort of other authors who are supervising the platform and typing articles, especially when those are not so familiar with plain HTML.

Related

Live templates in phpstorm - creates html tags instead of snippet

I'm trying to set up a simple snippet that writes out <?php ?> whenever i type php + TAB.
I set the context to be php files, but whenever I'm in a php file and write php + TAB it writes out <php></php>. So it seems that the HTML Zen Coding scheme is overriding my snippet. I use Zen coding a lot so I do not want to turn this off, but I would like my snippets to have higher priority. How can I fix this?
I did try to use the "apply now" button, as well as restarting PhpStorm.
I had set the context to be php, but unlike Sublime Text which simply looks at file-extensions to determine the context, PhpStorm looks whether I am actually within a php context. Since I am trying to write php tags I am most obviously not.
I changed the context to HTML and it solved the problem.

how do I find out what php function from Wordpress is generating blocks of HTML using browser inspector?

I'm developing a Wordpress site, which I'm fairly new to. I'm not sure if this is a stupid question or not but I haven't been able to return any decent google results regarding this. Anyway, is there a way to find out what PHP function is generating a piece of HTML code using a browser code inspector like Chrome's? Thanks!
No.
Once the data arrive to the browser, all the PHP code have been processed and you can't know what part of PHP generated which part of the HTML code.
No - not without modifying the php code to enable some kind of debugging. Chrome can only give you information about the received html document on the client side (you). But php code gets parsed server side.
You kind of can:
Download a copy of the theme and plugins folder
Open the page on your site that you want to find the function for.
Find a div/class that is specific to section e.g. <article>
Open a text editor like notepad++ (one that will allow you to search through multiple files at ones)
Use the find feature of chosen text editor and search for the div/class
The result will show you a list of pages where that term is.
Look through those pages for the function you are looking for (it might take a few goes)
The above it is a bit of a roundabout way of doing it, but I think other than looking through each file separately, it is you next best way.

Is there a way to auto-indent HTML/PHP files?

My first place to look at this was a fix with Notepad++.
This quite quickly brought me to "TextFX HTML Tidy".
Read the description and it seemed to be the problem for all my problems.
However, the install is quite hard, apparently TextFX used to be standard practice for Notepad++, for some reason that is no longer the case. I eventually fixed this by downloading an older install for Notepad++ and copied the plugin folder to my own Notepad++ file.
This gave me acces to the correct plugin, but this plugin is written purely for HTML, C++, or XML.
Since I use php in my files, this gives some complications. Normal tags are ignored as they should be, but when I use php inside an html string, in a link for instance, the php tags get converted to html.
For instance:
The start of my sentence Here my anchor tekst.
After tidy HTML becomes
The start of my sentence Here my anchor tekst.
Rendering this solution unusable.
There must be a lot of people looking for this functionality, and since this one is no longer standard practice for Notepad++, I figured there must be a better method to auto format your HTML code. But for some reason I can't find it.
So my question is: Is there a way to autoformat my code, clearing empty lines and indenting tags in the correct opening and closing order?
Preferably with Notepad++ but any other program will do.
Kind regards
For anyone looking for the same things. Switching to Netbeans did the trick for me, options with Notepad++ are still appreciated.
In Netbeans, using Shift+alt+F did the trick for me.

How do I manipulate the output of a PHP script when it is already manipulated by another (plug-in) script?

I take it you are confused. So am I, but I'll try to formulate this as well as I can.
The content management system I use has a third-party plug-in installed that manipulates the output of the pages produced by the CMS. That's what it's supposed to do, and that's why I installed it, but there's one small part of those manipulations that I need to get rid of.
The plug-in looks for the </title> tag in the HTML output and then adds an unwanted tag right after it (by replacing </title> with </title><unwanted tag>).
You might think, why not just dig into the plug-in source and comment out that particular function? Well, that's the kicker: the plug-in is encoded with Zend Guard, so I can't make heads nor tails of its source, and unfortunately the developer is not willing to assist.
One other manipulation that I was able to get rid of by myself, was the extra (and again unwanted) HTTP header it set for every page.
The Zend-encoded PHP file is loaded by a regular PHP file, and I was able to unset the above mentioned header by adding the following bit of code to the very bottom of this 'load file', before ?>:
header_remove("X-Enhanced-By");
It works splendidly, but that was about as far as my experience and research could take me.
The last thing, then, that I need to undo, is the manipulation of the title tag. I temporarily worked around it by changing all my </title> tags to </title >, but that seems hardly a proper workaround.
If I can unset the header by placing header_remove("X-Enhanced-By"); right before ?>, does that mean I can also use that same area to undo the addition of the unwanted tag after </title>?
Let's assume the plug-in replaces </title> with </title><base href="http://www.example.com/" /> on every page that is put out by the CMS.
How would I go about undoing that?
Depending on the CMS framework. Basically you should be able to create a hook/plugin which captures the output at a higher level than your plugin then regex the tags out.
I get it that the plugin installed already does that so it should be "doable"

Display highlighted HTML source code in Firefox?

Is there some clever content-type setting that makes Firefox display highlighted HTML source code instead of rendering it?
I have a CMS that generates HTML pages. I get debug info on each generated page by adding "/debug" to the URL. I would like to see the source by using "/source" so I have the source within my Firefox tabs (and not as an extra window).
I toyed with
ob_start()
and
highlight_string(ob_get_contents())
but it didn't work quickly, I find it too complicated and I like to avoid working with buffering when I can.
Maybe there is a simpler way to do this?
Edit: I will be using header("content-type: text/plain") for the time being but that doesn't highlight the code. I am looking for something like "content-type: text/html-source" or similar.)
Some Browsers already have HTML syntax highlighting built in. In Firefox & Chrome you could link to
View Source
or use the (highlighted) source view inside an iframe:
<iframe src="view-source:http://etc"/>
This obviously doesn't really work cross-browser but you might be able to live with that in a custom made CMS.
You could use
<p>
This very <em>system</em> which <a href="http://stackoverflow.com/">this
website</a> uses. It's called Prettify.
</p>
http://code.google.com/p/google-code-prettify/
Have you looked at installing a third-party syntax highlighter? I'm considering adding one to a project that uses a hand-built CMS system to allow staff to edit HTML content directly.
You could use something like Geshi It's quite useful, and highlights a lot more languages than just html, in case you ever needed that.

Categories