Home Learn More Purchase Knowledge Base Support Contact

Community Forums

KBPublisher Forums » KBPublisher Code Hacks and Customization Discussion

php code in template

(3 posts)
  • Started 3 years ago by feroxltd
  • Latest reply from chrisbjax

  1. feroxltd
    Member

    When trying to add some peace of php code it only shows up as blank.

    [code]<?php chdir("/var/wkscript/www/ads"); include_once("/var/wkscript/www/ads/mysimpleads.php");show_ad_group(4); ?> [/code]

    The cose is from my ad server.

    Anyone know how I can the php code to work and display the ads correctly?

    Posted 3 years ago #
  2. onesign
    Key Master

    In template:
    {my_add_block}

    In appropriate view class:
    chdir("/var/wkscript/www/ads"); // why this?
    include_once("/var/wkscript/www/ads/mysimpleads.php");
    $tpl->tplAssign('my_add_block', show_ad_group(4));

    By the way in version 3.0 there is "Global Variable"
    example of adding global variable to template
    in template you should have a template tag, for example - {global_test}

    in index.php after $page = &new KBClientPageRenderer($view, $manager);

    $page->assign('global_test', '<b>test global variable</b>');

    Posted 3 years ago #
  3. chrisbjax
    Member

    Hi,
    I'm trying to do something similar, and I don't think I am understanding what the syntax is.

    I would like to include a php file on the the knowledgebase (Its a simply adldap recognition function that prints firstname last name)

    If I understand correctly, I would open the page.html template and add my {recog} block where I want it.

    :: Heres where i'm fuzzy ::

    I then open Index.php and add my inclusion?
    include_once("../includes/adldap/whoami.php");

    Where am I converting it to the template variable?

    I tried $tpl->tplAssign('recog'); But I know this isnt correct, because this is not even references my inclusion.
    I'm guessing I need to add a function??
    May I get some insight?

    Posted 3 years ago #

RSS feed for this topic

Reply

You must log in to post.

© 2008 Double Jade LLC | customer.service@kbpublisher.com