Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get_component function
#1
hi everyone,
I'm having a trouble that I don't know why
if I type
Code:
<?php get_component('tagline'); ?>
it will output:
Just Another GetSimple Website<?

annoying <? breaks my template,
and I have solved this by omitting . "<?" in get_component function (admin/inc/theme_functions.php)
Code:
eval("?>" . stripslashes(htmlspecialchars_decode($component->value, ENT_QUOTES)) . "<?");
but does it effects other components ?
Reply
#2
I don't think so. I've seen this only on localhost... but never on a public-facing server. If you remove it it will try to eval everything after the <? so it could be a problem if you have a mixture of PHP code and HTML within your components
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#3
uhm, I'm testing on localhost
Reply
#4
Its strange, I don't know why locallost is so different in this regard.
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#5
I installed lastest stable Apache, PHP with default settings (just changed htdocs path). Why there is "<?" ??
Reply
#6
me too, but i see it on one of my localhosts too. I don't have an explanation for it
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#7
although I can't replicate, I do recall having a similar problem before on localhost when i used to start my PHP code with just "<?" instead of "<?php"

If you change the line in Theme_function.php to this it should work.

Code:
eval("?>" . stripslashes(htmlspecialchars_decode($component->value, ENT_QUOTES)) . "<?php ");

Mike.
My Github Repos: Github
Website: DigiMute
Reply
#8
n00dles101 Wrote:I do recall having a similar problem before on localhost when i used to start my PHP code with just "<?" instead of "<?php".
This is often because we who run simple server software on our development computers don’t know about server configurations. PHP has to specifically be told to support the shorthand syntax. It is often one of the first things I check, whether the shorthand <? is enabled or not.

If you still have problems with this let me know, I can probably look up what it is that needs changing without to much problem.

Could this also be the problem people are having with localhost? That might be why not everyone has the problem, as the default settings differ between server packages.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#9
From the PHP site.

Example #2 PHP Opening and Closing Tags

Code:
1.  <?php echo 'if you want to serve XHTML or XML documents, do it like this'; ?>

2.  <script language="php">
        echo 'some editors (like FrontPage) don\'t
              like processing instructions';
    </script>

3.  <? echo 'this is the simplest, an SGML processing instruction'; ?>
    <?= expression ?> This is a shortcut for "<? echo expression ?>"

4.  <% echo 'You may optionally use ASP-style tags'; %>
    <%= $variable; # This is a shortcut for "<% echo . . ." %>


While the tags seen in examples one and two are both always available, example one is the most commonly used, and recommended, of the two.

Short tags (example three) are only available when they are enabled via the short_open_tag php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option.

ASP style tags (example four) are only available when they are enabled via the asp_tags php.ini configuration file directive.

Note: Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control, because short tags may not be supported on the target server. For portable, redistributable code, be sure not to use short tags.


Chris, might be an idea to change that line in the next revision to just so were covered:

Code:
eval("?>" . stripslashes(htmlspecialchars_decode($component->value, ENT_QUOTES)) . "<?php ");
My Github Repos: Github
Website: DigiMute
Reply
#10
I've added it to the next version Mike... Thanks
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply




Users browsing this thread: 1 Guest(s)