Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: [IMPORTANT] Include php tags for standalone files  (Read 10737 times)

Fred K

  • Still trying to learn stuff
  • ULTIMATE member
  • ******
  • Karma: 130
  • Posts: 2728
    • Personal
[IMPORTANT] Include php tags for standalone files
« on: December 10, 2006, 12:03:16 AM »

Something to remember for all fellow translators and/or users of language variables:
In order for the code to work as a standalone file, i.e if you say "copy the code and save as snews_XX.php", it must include the opening and closing php tag, for example:
Quote

/********************************************************
    sNews 1.5
    Developers version: 1.5.30 Stable
    Copyright (C) 2006 Solucija.com
    sNews is licensed under a Creative Commons License
    FRENCH TRANSLATION BY: sNews TEAM
*********************************************************/
   
#SITE LANGUAGE VARIABLES
$l['home'] =
...
?>
I know some of the translations already have this, but some don't so it might be worth knowing about.
(If the php tags aren't included, the translation must be pasted into snews.php, replacing the original language variables; it won't work as standalone file.)
Logged

alexanderpas

  • Newbie
  • *
  • Karma: 0
  • Posts: 9
[IMPORTANT] Include php tags for standalone files
« Reply #1 on: May 15, 2007, 10:00:39 AM »

if pasting as a sepereate php file, without any HTML in it please, do not include the ?> tag as this is not required by php for php-only files, and can fix possible future bugs

from: http://nl2.php.net/language.basic-syntax.instruction-separation
Quote
Note: The closing tag of a PHP block at the end of a file is optional, and in some cases omitting it is helpful when using include() or require(), so unwanted whitespace will not occur at the end of files, and you will still be able to add headers to the response later. It is also handy if you use output buffering, and would not like to see added unwanted whitespace at the end of the parts generated by the included files.
Logged

Joost

  • Guest
[IMPORTANT] Include php tags for standalone files
« Reply #2 on: May 15, 2007, 12:58:54 PM »

In pmwiki it is standard not to include the endtag in a file, for the same reason alexanderpas mentioned. Perhaps this should be discussed.
Logged

codetwist

  • Hero Member
  • *****
  • Karma: 50
  • Posts: 940
[IMPORTANT] Include php tags for standalone files
« Reply #3 on: May 15, 2007, 02:24:29 PM »

Theses translation files are meant for inclusion in php code and do not provide for direct generation of output; so, unwanted white spaces and headers aren't an issue.
Logged