Send private message

You must be logged in to send a private message.

Friends

No friends yet.

Group membership

Activity

  • Amphios added a new discussion topic Not getting how this works in the group Theme Development
    Okay, I thought I was getting this but I guess not. How exactly does this whole "veiws" thing work. I've got a theme that's echoing a file that displays the topbar.php (/pages/elements/topbar.php) but for the life of me I cant find it so edit what I...
  • Amphios replied on the discussion topic Site loads the default index and then the plugin index
    Here's what I've got, should make it easier.   <?php function mcsindex_init() { // Replace the default index page elgg_register_plugin_hook_handler('index', 'system', 'new_index');} function new_index() { if... view reply
  • Amphios replied on the discussion topic Adding $name, $joindate, ect
    Also, if I try say add your code, it wont load the site anymore, giving a default 'server error'. So adding <?php echo elgg_echo(theme:hello), array($current_user->name)); ?> in the default.php of the themes html it throw's an... view reply
  • Amphios replied on the discussion topic Adding $name, $joindate, ect
    This is really useful, thank you. This is actually what I meant, not using just static variabled on their own. I couldn't really think of a way to describe it. I'm a front end developer, I know only the basics when it comes to back end... view reply
  • Amphios added a new discussion topic Adding $name, $joindate, ect in the group Theme Development
    Hey Guys, So I've creatd a theme, but it's full of dummy text such as "Name here" and things like that. Can I just use the variabled in the default.php and the other pages so it would show say a username? Thanks, Vaughan
    • Basically, the answer is yes, you can use variables. But I don't think it makes sense to use variables in a theme (= look of site). Only if your theme would also include code for example to build up the login page, index page or other pages (filling them for example with widgets or other content) I would think it useful to include personalized elements there.

      $current_user = elgg_get_logged_in_user_entitiy();

      echo "Hello" . $current_user->name;

      would display "Hello <name>" for the currently logged in user with <name> replaced by this users Display name.

      Or better use

      echo elgg_echo(my_theme:hello), array($current_user->name));

      to be able to manage the text output via a language file which would also allow multi-language text output.

      In language file this would be defined for example as

      'my_theme:hello' => 'Hello %s',

      http://reference.elgg.org/ might be a starting point to look up available Elgg functions and their syntax. But you might also study the code of other plugins / theme plugins to learn more about Elgg functions and their use.

    • This is really useful, thank you. This is actually what I meant, not using just static variabled on their own. I couldn't really think of a way to describe it. I'm a front end developer, I know only the basics when it comes to back end programming/php! This is me trying to learn in a way I find useful. 

      So using it from a laungage file would be better? It seems that way from the way you've put it. So if I wanted to go back and change the way it's worded I wouldn't have to touched the index.php let's say but instead just go to the laungage file and change it there which would change the live code? 

      Thank you very much I'll have a read and tinker about!

    • Also, if I try say add your code, it wont load the site anymore, giving a default 'server error'.

      So adding <?php echo elgg_echo(theme:hello), array($current_user->name)); ?> in the default.php of the themes html it throw's an error.

       

  • Amphios added a new discussion topic Site loads the default index and then the plugin index in the group Plugin Development
    Does anyone know how to stop the default index (login box, ect) loading and then the plugin loading on top of it? When the browser loads or you refresh the page you can see the default login box load and then dissapear and be replaced with the index...
    • Are you returning true for the custom index hook?

    • Here's what I've got, should make it easier.

       

      <?php

      function mcsindex_init() {
      // Replace the default index page
      elgg_register_plugin_hook_handler('index', 'system', 'new_index');
      }

      function new_index() {
      if (!include_once(dirname(dirname(__FILE__)) . "/mcsindex/pages/index.php"))
      return false;

      return true;
      }

      // register for the init, system event when our plugin start.php is loaded
      elgg_register_event_handler('init', 'system', 'mcsindex_init');
      ?>

  • Amphios replied on the discussion topic Add a custom index
    Nevermind, done it. I used one of your links and found a little tutorial to create a custom index plugin which worked perfectly. Thank you! :) view reply
  • Amphios replied on the discussion topic Add a custom index
    Basically, I've got a theme and I want to over-right the ugly login/register page with one I've made. So when you go to www.site.com/elgg it will show the login/register page instead of the default that comes with elgg/theme. Does that make more... view reply