can't use language variables

  • hello there,
    i've been reading the documentation and trying to apply it in real test
    well,the database methods worked so great without problems
    i had a problem with the template engine (none said that i must change the templates path using WCF::getTPL()->setTemplatePaths($templatePaths); -.-)
    now with language
    i tried to get the 'wcf.acp' value but i couldn't
    i read somewhere i must register a new value with my package id and with new variables
    i did so but it still prints the variable name not the content
    a fast help is appreciated
    thank you and Best Regards

  • wcf.acp has no value, it's just a category ;) You have to install a language xml within your package where you can define your own variables. Take a look at an existing plugin to see how it works. Then you can use it in templates and in your scripts.

    Cacator cave malum! Aut si contempseris, habeas Jovem iratum!

  • Quote

    i read somewhere i must register a new value with my package id and with new variables
    i did so but it still prints the variable name not the content


    i changed it
    i don't know why you telling me to create a package for something doesn't exist yet !
    what to include in that package ????

  • Hallo SAFAD,


    what exactly do you want to achieve? If you want to add any functionality or a new page to your forum (or the underlying Community Framework) you need to create a package (at least if you want to do it right).


    This package includes all new PHP-Files, templates and also XML files with configuration data, like new language variables. If you want to add a new language variable called "wcf.anyplugin.newcategory.variableName" which is in the language variable category "wcf.anyplugin.newcategory", you need to include a file with this content (for English):

    XML
    <?xml version="1.0" encoding="UTF-8"?>
    <language xmlns="http://www.woltlab.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.woltlab.com/XSD/language.xsd" languagecode="en">
    	<category name="wcf.anyplugin.newcategory">
    		<item name="wcf.anyplugin.newcategory.variableName"><![CDATA[Text of the language variable]]></item>
    	</category>
    </language>


    An (may-be in some parts not up-to-date) overview of the different components of a package can be found in Part II of the Technical Documentation of WoltLab Community Framework. And as Plunts already said, the best way to see how a package "looks like" (if you never created a package) is to download a package from the database and unzip it ;).

  • i am making a stand alone application based on the woltlab community framework,
    i still don't understand how to make a package for something isn't created yet
    i need to make that thing then package it
    unless Germans work upside down =P

  • i still don't understand how to make a package for something isn't created yet


    Sorry SAFAD, but I honestly don't understand what you want to tell us with this sentence ;). What exactly isn't created yet?


    This is how you can create a package (Note: This is no chronologically ordered list, though you should do the first steps before you do the last one ;).):
    - Write your PHP classes and zip them to files.tar.
    - Write your templates (for the frontend) and zip them to templates.tar.
    - Write your acp templates and zip them to acptemplates.tar.
    - Write the package.xml file with all needed data (see documentation).
    - Write a language XML-file with all used language variables from the templates.
    - Write other XML-files (eventlisteners, menus, etc., also see documentation).
    - Zip all these files to a tar- or tar.gz-file and install that file/package.

  • ok
    you said "Write your PHP classes"
    ok i'm done i've written my classes and my php files
    but my php files contains language variables,when i test the php file the variables won't work

  • but my php files contains language variables,when i test the php file the variables won't work


    They CAN NOT work, when you did not register them properly...


    When you create a package, and add your files to that package, along with the needed language variables, and then install it, everthing will work, when you did it properly.

    "A life is like a garden. Perfect moments can be had, but not preserved, except in memory. LLAP" — Leonard Nimoy

  • Hello SAFAD,


    first of all: In most cases (but not always) the PHP classes shouldn't contain language variables since they are part of what is shown to the user which is the task of the templates.


    If you use

    Code
    {lang}wcf.anyplugin.newcategory.variableName{/lang}

    in a template or

    PHP
    WCF::getLanguage()->get('wcf.anyplugin.newcategory.variableName')

    in a PHP class this language variable needs to be installed via the LanguagesPackageInstallationPlugin which interprets the language XML-files and saves (or updates or deletes) the language variables from this file.


    So, as long as you don't install that standalone application with the language file included you will just see the language variable names instead of their values since they are not in the database ;).


    PS: Well, Tr3kk3r was a bit faster ;).

  • i've created the package,
    tried to install it, but it hangs in 75%
    because of a duplicate entry,i'll try to fix it and post back

  • Hello SAFAD,


    though you deleted the error message, I read it and just a quick comment: config.inc.php is no file that should be included in your standalone application since this file (containing the database connection settings) is created automatically by Community Framework :).

  • oh lol,well it was a dumb error i didn't read at the begin (duplicate entry..sigh) and thought i would look dumb for posting it =P
    ok i'll try again without that file
    EDIT : yes WCF autocreates that file,but still
    can't use language variables :cursing:

    Edited once, last by SAFAD ().

  • Maybe you could assign your package in your next post for us? So we could take a look and tell you whats wrong :)

  • Hello SAFAD,


    I'm not sure what you want to achieve with those files? Are they just for test purposes since they have hardly anything to do with a real standalone application. I think you should download Woltlab Burning Board then unzip WCFSetup.tar.gz, go to install/packages/ and unzip com.woltlab.wbb.tar.gz. There you can see how a standalone application has to look like.


    But lets take a look at your global.php-file:

    Since the name of your package is com.realitydesk.core Community Framework will create CORE_DIR which contains path to the dictionary where you installed the application. RD_DIR and TPL_DIR are not defined.


    And in most cases you will write an own core class that extends WCF, so that you create an object of this class and not of WCF.


    Have you already worked with Woltlab Community Framework? If not, you might want to start with a simple plugin, like adding an static page or a dynamic page to get to know the framework and may-be then write a standalone application since there you need to know the framework :).