Skip to main content
Topic: Lets lets add a home page! (Read 18095 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Lets lets add a home page!

Reply #15

Hey question: has anyone tried shoving this into an elk yet? Just curious, since the last change on the repo was 3 months ago, and elks these days may protest at the intrusion.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Lets lets add a home page!

Reply #16

Hey I just tried force feeding this critter to an elk. The elk didn't like it much. Got a bad case of indigestion. :P

After editing package-info.xml to suit 1.0 Alpha, the only apparent glitch was with the second edit in sources/Dispatcher.class.php:

Code: [Select]
<operation>
            <search position="replace"><![CDATA[                // was it, wasn't it....
                if (empty($this->_function_name))
                {
                    $this->_file_name = $default_action['file'];
                    $this->_function_name = $default_action['function'];
                }]]></search>
            <add><![CDATA[                $tpAction = whichTPAction();
                if (!empty($tpAction))
                    return $tpAction;
                    ]]></add>
        </operation>

So I found the corresponding code in the latest elk's intestines:
Code: [Select]
// was it, wasn't it....
                if (empty($this->_function_name))
                {
                    $this->_file_name = $default_action['file'];
                    if (isset($default_action['controller']))
                        $this->_controller_name = $default_action['controller'];
                    $this->_function_name = $default_action['function'];
                }

And tried replacing it with this:
Code: [Select]
// Testing TP edits...
                $tpAction = whichTPAction();
                if (!empty($tpAction))
                    return $tpAction;
                // End testing TP edits...

Result: one grumpy elk, which didn't want to play and was sulking in the corner.

Got the TP stuff from here, which I think is the right repo: https://github.com/engelnyst/elk-tiny-portal

ETA: Admin was ok, but trying to go to board index gave "Fatal error: Call to undefined function whichTPAction() in K:\VertrigoServ\www\elkarte_tp\sources\Dispatcher.class.php on line 108"

#   Time   Memory   Function   Location
1   0.0007   402592   {main}( )   ..\index.php:0
2   0.0310   4620976   elk_main( )   ..\index.php:143
3   0.0413   5020264   Site_Dispatcher->__construct( )   ..\index.php:209
Last Edit: June 08, 2013, 04:38:14 am by Antechinus
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Lets lets add a home page!

Reply #17

Aha. It hasn't added any admin shiz for the portal. D'oh. No settings, tabs or anything. Looks like it still needs a fair bit of work before it's usable.
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Lets lets add a home page!

Reply #18

No, we haven't made a decision because we're still debating going paid - though if we do go open source, it'll be MPL 2.0 with Exhibit B.

Re: Lets lets add a home page!

Reply #19

Was thinking about starting some new portal stuff. Is feature cat going to get working on this or what? :D
Success is not the result of spontaneous combustion, you must set yourself on fire!

Re: Lets lets add a home page!

Reply #20

Quote from: TestMonkey – I think it meant for starters! On a related note, it'll be interesting to see if/what challenges a portal/blog/article system still poses on our codebase.
One thing I have in mind for the blog-like is, since now there is an hook where query_see_board is generated, to use a board and remove the board from the boardindex, not sure about the admin panel yet (I may use an entirely different page for the configuration).
Of course this is still at the stage of thoughts. Nothing done yet.
Once this is done, the other thing to do would be to replicate the Display controller (or maybe extend it? Probably is not yet ready for extend...) in order to inject somewhere the query to show the first message on all the pages of the topic.
The rest should be the same (i.e. MessageIndex).

Do you see any drawback?
Bugs creator.
Features destroyer.
Template killer.

Re: Lets lets add a home page!

Reply #21

 Feature Cat doesn't know about them drawbacks.

Please, try it! Display controller can be extended already now, afaics. TE re-worked it to a decent class with its actions alone, and we've accepted a helper method for the template callback. re-checks the code quickly*... Hey, it haz *no $db anymore, not even one! ;) (but it haz 14 (that's fourteen) globalz as of now)
Btw: https://github.com/elkarte/Elkarte/pull/569
It'd be interesting to know how this'll work: could make the dispatcher call a subclass instead of the Display controller class, just it'll have to be only one action_ method replacement hooked.

Re: Lets lets add a home page!

Reply #22

Yep, it is possible to extend it, though there isn't much code that can be reused as far as I can see...
In fact it would be an extend for the sake of extending it and nothing more...

I was thinking to split it up a bit like that:
https://github.com/emanuele45/Dialogo/blob/display_controller/sources/controllers/Display.controller.php
Of course I don't know if this is a good thing, though in my mind seems easier to deal with and there may be pieces that can be reused.
In fact I think that the only thing I should replace is also the one that I put as private and so cannot be replaced... lol
Bugs creator.
Features destroyer.
Template killer.


Re: Lets lets add a home page!

Reply #24

Me thinks this needs to be revisited. The way the current hook works, will not allow you to push the forum off to another action. The hook is only called if $_GET['action'] is empty. Which means, your front page hook works great if you hook into it because the $_GET['action'] is empty.  I think the hook needs to be pushed up before the empty() check for action. Maybe right after the $default_action[] array is set. This way, the default action can be overridden. But this would mean that whoever hooks into the frontpage will need to make sure they take care of setting the default action if not on the frontpage. Hope that makes sense. And please tell me if I'm not thinking right about this.
Success is not the result of spontaneous combustion, you must set yourself on fire!

Re: Lets lets add a home page!

Reply #25

meh... looks like that won't work either to move the hook up. $default_action never gets set either, unless $_GET['action'] is empty...
Success is not the result of spontaneous combustion, you must set yourself on fire!

Re: Lets lets add a home page!

Reply #26

First thought (which doesn't answer the issue, I think): if we add a home page, I'd think it has to be the default action for Elk no-hooks install, right? We can also set 'action=home' on it. So, that changes the scenario to: the default action will be "the action when no valid ;action= is set", and the home page will be "action=home".
By default, the default action (=the action when no valid ;action= param is set) would be redirected to 'home'. The hook overrides that.

Does that make sense? (disclaimer: 3 am!)

How should it all behave instead?
ETA: please note, Elk recognizes actions with no 'action' set, but another forum-ish parameter: index.php?msg=321.
The best moment for testing your PR is right after you merge it. Can't miss with that one.

Re: Lets lets add a home page!

Reply #27

Ah yes. I think that will fix the problem. A default_action of "home" will need to be specified, at which point we are overriding this with our hook. The forum action (Boardindex) will have to be tied to a different action (not default). Maybe this is something I can work on. Been itching to join the party a little here. Just a little shy and lacking a bit of courage to think my code will hang with the big boys and girls. :D

Success is not the result of spontaneous combustion, you must set yourself on fire!

Re: Lets lets add a home page!

Reply #28

ROFL. Reminds me of when I joined the 2.0 dev cycle. I thought everyone there knew heaps about front end stuff, then realised I knew almost as much as they did, then learned more. :D
Master of Expletives: Now with improved family f@&king friendliness! :D

Sources code: making easy front end changes difficult since 1873. :P

Re: Lets lets add a home page!

Reply #29

Does everyone want to be able to enable/disable the homepage option?  I was thinking a nice little checkbox to give the option in Features and Options > Layout > Enable homepage. Then we could just provide a basic html layout welcome page so that people know they can customize their own homepage.
Success is not the result of spontaneous combustion, you must set yourself on fire!