Hello folks, i am beginner in st3 and i dont know how st3 show me html code between php tags, is it posible in st3?
Autocomplete html into php, is it posible?
Hard to understand…
What do you want know? what is your problem?
Can you give us an example
Then, we might be able to help you…
It is simple, when i write html code between php tags for example echo “
Hello
” i want that autocomplete function for html work, that is that st3 show me the html tags inside the tags php <?php ?>.There is one way I can think, edit the PHP syntax to embed the HTML when echo
statements are found.
Also, with this you will also see the HTML coloring syntax on the echo.
I tried to edit the default PHP Source
syntax changing this:
contexts:
main:
- include: statements
To:
contexts:
main:
- match: \becho\b\s*[\']
push: "Packages/HTML/HTML.sublime-syntax"
with_prototype:
- match: .*[\']
pop: true
- match: .*[\']
push: "Packages/HTML/HTML.sublime-syntax"
- match: .*[\']\s;
pop: true
- include: main
- include: statements
But did not worked. I used this View Test syntax:
<?php
session_start();
if( isset( $_REQUEST[ 'width' ] ) AND isset( $_REQUEST[ 'height' ] ) )
{
$_SESSION[ 'screen_width' ] = $_REQUEST[ 'width' ];
$_SESSION[ 'screen_height' ] = $_REQUEST[ 'height' ];
header( 'Location: ' . $_SERVER[ 'PHP_SELF' ] );
} else
{
echo '<script type="text/javascript">
window.location = "' . $_SERVER[ 'PHP_SELF' ] . '?width=" + screen.width + "&height=" + screen.height;
</script>';
}
header( 'Cache-control: private' ); // IE 6 FIX
switch( $lang )
{
case 'pt':
$lang_file = 'lang.pt.php';
break;
default:
$lang_file = 'lang.en.php';
}
?>
I would suggest using heredoc strings, but currently there is a bug that prevents HTML suggestions inside them…
<?php echo <<<HTML
<section></section>
HTML;
?>
but this might be fixed in a later build: https://github.com/sublimehq/Packages/pull/624
Plugin that supports multiple syntax in a scope
Hey!
You could do
<?php ... ?>something with some <code>html<code> in it<?php ... ?>
instead of this
echo "something with some <code>html<code> in it"
So, you get the html coloration and completion, you don’t have to worry about the quote…