Skocz do zawartości
Zaloguj się, aby obserwować  
Invisionize.eu

[Invisionize.eu] Starting from Scratch - Hello World! - An IPB.Board 3 mod - Part 3

Polecane posty

That white screen of death points the way for what needs to be done to get this Hello World! application working, and to work quickly so there are no similar problems with dual naming of things. I guess that's one of the problems with copying an existing application and using it as the starting point.

The file:

/admin/applications_addon/other/helloapp/modules_public/hellomod/hellosec.php is a copy of the file

/admin/applications_addon/ips/calendar/modules_public/calendar/calendars.php

and looking at the hellosec.php file there is this declaration:

class public_calendar_calendar_calendars extends ipsCommand

That relates to public_<appname>_<modulename>_<sectionname> , so I need to change it to:

class public_helloapp_hellomod_hellosec extends ipsCommand

And when I go to the public board now, and click on the 'Hello World' tab, what happens? Nothing. :(

If I hover over the 'Hello World' tab, in my browser status bar, I can see that the link should take me to <board_URL>/index.php?app=helloapp There is no reference to the module or the section in that URL. In the hellosec folder I created there is a defaultSections.php file which (unsurprisingly) specifies what the default Section should be. But in the hellomod folder there is nothing equivalent. So how does IP.Board know which module (and therefore which folder structure) to use for the php files it should be executing? The Calendar app seems to 'know' which module to use.

Additionally, if I manually type in the URL into my browser address bar as <board_URL>/index.php?app=helloapp&module=hellomod&section=hellosec I see this:

http://forums.invisionpower.com/uploads/1250719389/gallery_3936_1189_30631.png

Not so much a 'Hello World' (notice that the tab is now highlighted), more of a 'Hello Calendar?' My 'Hello World!' app is now running, but all the code is a direct copy of the calendar application.

(A Digression: All I've done so far is copy and rename a few folders and declarations within some files. So the code that's running under my 'Hello World' tab is a direct copy of the calendar application. The reason it doesn't quite look right is because it is looking for a language file with 'helloapp' in the filename. That file doesn't exist yet so there is blank text in some of the output. The most notable place is in the buttons top right below the main IP.Board banner.)

Getting the text right by producing my own language files will come later, and the above is a bit of a distraction. What I'm REALLY interested in is making this page display when I click the tab, and not needing to manually type in the URL. The answer lies in AdminCP. Looking at the Calendar application, a public module has been defined:

http://forums.invisionpower.com/uploads/1250719389/gallery_3936_1189_24193.png

Clicking on Manage Public Modules above gives this:

http://forums.invisionpower.com/uploads/1250719389/gallery_3936_1189_5871.png

and clicking on the name of the module gives this:

http://forums.invisionpower.com/uploads/1250719389/gallery_3936_1189_15915.png

The relevant thing here is the Module Key . It is the name of the folder that contains the module and associated folders and files, including the sections. In my case it's hellomod , and a few clicks later, including the 'Add Public Module' button, I have this for the Hello World application that I defined right at the beginning. (If you're following this yourself, take care not to add this module to the Calendar applicatiion instead of the Hello World application)

http://forums.invisionpower.com/uploads/1250719389/gallery_3936_1189_47799.png

Back on the public side, clicking on the Hello World tab and ...

YES! :)

The language file is still incorrect, I've got the calendar code running instead of my own, and the calendar skin instead of my own being used. But fixing that comes ..... Later :)

Zobacz Artykuł w pełnej wersji

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Bądź aktywny! Zaloguj się lub utwórz konto

Tylko zarejestrowani użytkownicy mogą komentować zawartość tej strony

Zaloguj się, aby obserwować  

  • Kto przegląda   0 użytkowników

    Brak zalogowanych użytkowników przeglądających tę stronę.

×

Ważne informacje

Kontynuując przeglądanie strony, wyrażasz zgodę na używanie przez nas plików cookies.