Php move cursor to last line - php

I am using a module in joomla called blank module which unfortunately does not come with much documentation. It allows you to specify HTML code and php. However the php output is always on a new line.
Is there any way in php where you can move the cursor back to the previous line before echoing output.
Current Behaviour
HTML OUTPUT
PHP OUTPUT
Desired Behaviour:
HTML OUTPUT PHP OUTPUT
by coding in moving to previous line in php.

In the end I did not find a solution with PHP but assigned a css tag to the second output and used:
position: relative;
tag to move the output!
A bit of a cheat but got the required results!
This can the first bit of documentation for Joomla blank module.

Related

PHP Wordpress: Where does print_r() output to in Safari?

If I execute
print_r('Hello');
on a Wordpress code snippet, where would this actually print? I'm using Safari.
print_r in php typically prints in the parent node of the node you placed the code within.
Since you didnt give more information i assume that
this is the php print_r.
So its most likely that the output will be in the middle of your HTML code or your snippet.
You should find it in the HTML source and maybe also see it on the website

How to properly use language format in Notepad ++

I have this situation trying to disable a sequence into a .php file (the black commented lines, back-to-top text button);
I've read about block commenting in notepad ++ and setting the language of the file but the comment it looks like is not implemented properly.
What I've done :
-File / Open the .php file,
(already it looks like it is viewed in php language judging by the colors)
-Selection between 355-359 lines and Block Comment (ctrl+shift+Q).After that, I've added the text but it doesn't look like the other existing comments.
Any thoughts? Thanks,
PHP comments only work when you are inside PHP mode (between <?php and ?>).
When you are outputting HTML, you need HTML comments which take the form <!-- comment which does not include two adjacent hyphens -->.
The PHP within an HTML comment will still execute and the results will be output to the browser. It looks like your PHP only outputs data and doesn't do any significant processing, so that will probably be sufficient. You might, especially in other cases, be better off simply deleting the code and then restoring it from your version control system's history later.
For that part of code you should comment using:
<!-- your comment -->
As you are using html (you closed the part of your php code by ?> )

Row segments in odtphp

I'm currently generating some invoices with odtphp. (https://github.com/cybermonde/odtphp)
I made a segment that contains a table which will be dynamic (and therefore also use a segment) so i use the [!-- BEGIN row.segmentname --] and [!-- END row.segmentname --] tags.
My first segment is working but the row segment won't work.
Here's the error it prints:
Fatal error: Uncaught exception 'OdfException' with message ''details' segment not found in the document
Here's the part of the code that's not working:
Has anyone experienced this?
while ($row = mysql_fetch_array($res))
{
$segment->setVars("codearticle", $row['codearticle']);
$segment->setVars("designation2", $row['designation']);
$segment->setVars("qte", $row['quantite']);
$segment->setVars("prixvente", $row['prixvente']);
$segment->setVars("totalpiece", $row['montantvente']);
$segment->merge();
}
$odf->mergesegment($segment);
What should I do to make this work?
So, after a while of fiddling with my php code, i opened content.xml (from the odt archive) with my text editor and saw that some parts of the text were separated by some xml markups.
I edited it and it seems to find the row tag.
I still have some minor problems, it won't get into my while loop, but at least this part works!

PHP - Syntax of exec() function to call another php file

This question is in reference to:
Free (preferably) PHP RTF to HTML converter?
I'm trying to execute that last line of code in my php:
exec(rtf2htm file.rtf file.html)
I understand what parameters need to go within the parentheses, I just do not know how to write it. I've looked at multiple examples along with the php documentation and still I remain confused, so could someone show me how it is written? rtf2htm refers to a PHP file which converts RTF to HTML.
Ultimately what I am trying to do is convert the content of numerous RTF docs to HTML, maintaining the formatting, while not creating tags such as<head> or <body> which programs like Word or TextEdit generate when converting to HTML.
rtf2htm is not a php script, it is a program installed on the server. exec() is used to call external applications.
EDIT: After looking up this script, it seems that it is indeed a php script. But it has been coded to be usable from the command line only.
This should work:
<?php
exec('php /path/to/rtf2htm /path/to/source.rtf /path/to/output.html');
?>

HTML minifier puts every tag on a new line

I am using a html minifier, which can be found here: HTML minify
The strange thing to me is that every tag is placed on a new line. Is this common behavior or am I doing something wrong. The output looks something like this:
Anyone know how I can fix this so that is just creates one line of code, or is has this was of minifying some advantages.
Checked the code?
// use newlines before 1st attribute in open tags (to limit line lengths)
$this->_html = preg_replace('/(<[a-z\\-]+)\\s+([^>]+>)/i', "$1\n$2", $this->_html);
Long lines can be a bad bad thing - browsers might fill buffers or just drop stuff at the end of the line. So it looks like that Minify script has it hard coded in, with no options to change. So if you really want it all on one line, just customise your version to not do that replacement. Open Source win.

Categories