I curious if there are plans to add some basic webpage features to G2 such as a links page?
I use G2 for my personal website and I want to add a few extra features like a links page. I used PHP-Nuke with gallery 1 and it worked fine but using PHP-Nuke seemed like overkill for the few basic items I want.
Ideas?
[url]www.markafoster.com[/url]
Posts: 53
If you just want a static page with the G2 layout, You'll need to make a very simple module. I can show you one that would do that, if you're interested.
Posts: 118
Sure, I would be interested. What do I need to do?
Posts: 118
Anybody else?
Posts: 7994
Kirill appears to be AWOL.
I've made a simple demo module that puts a "My Stuff" box in the sidebar and a "My Page" link in it, which takes you to a very simple view that just renders the template of your choice. I'm attaching it here.
Note that in the template I'm using {g->text} blocks which will localize your strings. If you don't care about localization, just put your text in verbatim and don't worry about that. I'm also doing $module->translate in HtmlPageView for the same reason.
This should be enough to get you started. Have fun!
Posts: 53
Oops. I honestly lost track of this topic, sorry! I'll see if I can whip something up tonight. Hang tight.
Posts: 53
Alright, Bharat's module should have started you off on the right foot, but in case you need a step by step walkthrough of the necessary steps take a look here. I've whipped up a couple of lessons that will teach you how to code a simple G2 module to do what you're trying to do. It's honestly not the greatest piece of literature, but it's a good rough draft for me. I'll edit it properly later .
Do note however, that the tutorial does not yet cover plugging in to the sidebar navigation as Bharat's module does.
Posts: 118
I am working through it, I will let you know how it goes
Posts: 53
Great! Let me know if there's anything you're stuck on.
Posts: 118
Kirill, I worked through yours and all went well. I did have an error when I tried to activate the tutorial1 but I think it was just a typo because once I copied your whole example page everything worked fine.
Here is the page http://www.markafoster.com/g2/main.php?g2_view=tutorial2:MyPage
Now I just need to decide what I want to do with this.
I liked you explanation of the basic files. That helped put things in perspective and I am sure it will help me out.
I am going to look through bharat's example now.
Posts: 53
Awesome. I didn't actually test out the code, so I'm glad to see it's all working.
You now have a basic grasp of the G2 module and templating system. If you want to add more pages, you can just duplicate MyPage.inc and MyPage.tpl and replace the instances of "MyPage" with the pagename.
Bharat's module is very similar to the one the tutorial teaches you to make, but the module.inc also sets a 'loadSystemContent' callback. Try adding that to your setCallbacks line and pasting the last block of Bharat's module.inc (the @see GalleryModule::loadSystemContent portion) to your module.inc in tutorial2 (make any necessary path changes). Then, copy the HtmlSystemContent.tpl to your tutorial2/templates dir.
This will essentially allow you to add a little block to the sidebar with links to your custom pages (or whatever else you'd want there).
Happy coding.
Posts: 118
I modified the HtmlSystemContent.tpl to have more links. That is half of what I was looking for. I plan to install webcalendar on my website and wanted to have a link to it.
Posts: 83
Bharat, thank you for html module.
The only problem I experienced with it while using G2 embedded into phpnuke, is that nuke's Sidebar Block shows "There isn't content right now for this block." as soon as i click on 'My page' (which shows up just fine).
The same problem could be seen when i try to use search located in sidevar: all results are correct, but sidebar shows "there isn't content.."
It could happen that problem comes form actual nukes' G2 module....
Posts: 32509
c4actbe, @embedded G2: is this "There isn't content right now for this block." message dependent on whether you have this html module installed or not? if it's dependent, it's likely a issue with the html module.
But i'm quite sure it has nothing to do with this module.
You get this message only, when you look non-G2 pages / Modules in phpnuke, right?
Posts: 83
nope. it hapens EVERY TIME when i use sidebar for accessing something else, other than images/albums, for example:
1. I type something in the search field located in sidebar and hit 'search'...
2. when i click 'advanced search', page refreshes...
3. I click on "Members List", and user list opens...
in all case the correct page opens, BUT all content in nuke's block-G2sidebar.php dissapears and shows up inside gallery2 module...
Posts: 32509
yeah, that's no bug, that's a known issue. all "(user) admin pages" can't show the sidebar outside the G2 html region.
Posts: 70
i've been playing around with this for a bit and i've got it working. i set up a faq on my site. the only problem is, the sidebar doesn't work. the link to my faq appears in the sidebar, but when the faq page loads, there is no sidebar. i followed the instructions in the tutorial, which says to use this:
am i missing something else? i'm a total novice with php.
by the way, this is exactly what i was looking for. i have another thread about an email module. i'm sure if i can get over this little issue, i'll be able to close out that other thread too. thanks in advance!
Posts: 32509
dj-3plet, i see that you have a question in your faq concerning speed. and you write that you host it on your own server. that's ideal. the only thing you have to do now is to install a php accelerator (phpa, turk mmcache or eaccelerator).
and you could also keep your database tables in RAM, and tweak the system in other ways.
as to your question. i guess the sidebar is not included because bharat thought more people would like it more like that.
could someone who uses this html module take a look at it? it should be fairly ease to include the sidebar, maybe in the template.
Posts: 70
thanks. i'll look into that. do you know of a tutorial?
Posts: 53
dj-3plet, after the nav. view is loaded it also must be included in the template to display it. Take a look at this lesson, particularly the MyPage.tpl file (note how there's a line including the template).
Good luck!
Edit: you might need to wait a whiiile for that page to load. Apache's being hit pretty hard, gotta figure out the problem ('Server up 89 days, 1:44, running 47.69 load.'). Eek!
Posts: 70
got it - thanks! all works fine now.
Posts: 70
last night i installed eaccelerator - what a difference! its literally 5 times faster now. thanks for the suggestion!
Posts: 7994
That's because my dummy module doesn't include any sidebar support. I'm redoing how that part of the system works, with Beta 3 as a target. If you can hold on for a while, then this should be resolved.
Posts: 7994
Kirill -- This is excellent! Can I add a link to it in the developer documents? Thanks!
Posts: 53
Thanks, feel free to link to it from the site - it's not going anywhere.
I'm planning on pursuing the writing of a lesson series idea. I know from experience how frustrating it can be to try to understand the G2 module system if you don't have significant PHP experience. However, I think the main challenge that has to be overcome is understanding how the files interact with each other and creating those first two or three modules. Once the developer 'gets' the system, they will need little assistance to teach themselves further functionality.
Any further comments welcome, of course.
Edit: it seems like this thread has strayed from it's original topic somewhat. Would it be possible to rename it to better reflect the nature of the discussion, so users searching/browsing the forum would be more likely to come across relevant information? Something like 'Custom pages for G2'.
Posts: 16
Does this still work for G2 Insightful? I loaded Bharat's module but I'm not seeing the "My Stuff" box in the sidebar. I had to change the CoreApi and ModuleApi to the current version and after that I was able to successfully install the module. What am I missing?
Posts: 16
Anybody?
Posts: 37
sorry for being so stupid....
I have to hang on to stukintx's question, I try both of these examples, try to install it, and that works, but for Kirills example, I get an error, and for Bharat's, the MyStuff on the sidebar does not show up.
Could the method here be to old???
Posts: 16
oddhNP, I don't think an answer will be forthcoming soon. Don't know why some questions are answered and some not but it appears that's the way it is here
Posts: 32509
that's just because we try to annoy you
actually, this is something i'd expect that Kirill or bharat would maintain because they were involved in creating this mini module. so that's the reason why perhaps noone answers. i should / could have let bharat know that there are questions in this topic.
however, i've just tested this module and after changing the required core api to 6,0 and the module api to 2,0 in the module.inc file, it installed correctly.
i can also browse to main.php?g2_view=html:HtmlPage and i see the page.
what else do you want?
another name? change the module / HtmlPage file and class names.
actually there's one thing in the module that is totally out of date.
function loadSystemContent(). this was a concept in G2 prior to beta 4. now it should be replaced by something else, e.g. just a link or a block.
Posts: 16
valiant, Thanks for your reply. As I stated in my initial post the module installed fine for me too after making the necessary changes but acording to the the post from bharat and I quote
"I've made a simple demo module that puts a "My Stuff" box in the sidebar and a "My Page" link in it, which takes you to a very simple view that just renders the template of your choice. I'm attaching it here. "
I do not see the My Stuff box on the sidebar. oddhNP wrote he had the same problem...no My Stuff box on the sidebar. I did delete the template and database cache but still no My Stuff box on the sidebar.
This is the spot I'm stuck at. Hopefully you can help us out.
Thanks again
Posts: 32509
the "my stuff box in the sidebar" is exactly this obsolete loadSystemContent thing that needs to be replaced by a G2 block. so someone would need to work a little on the module.
bharat and the rest of the dev team are very busy at the moment with getting g 2.0 out of the door, so don't expect something from us at the moment.
Posts: 16
valiant...thanks for the info. At least I now know it's not something I was doing wrong
Posts: 14
Where can I find Bharat's static html module?
Posts: 32509
it's the attachement to the first post of this topic.
but please read the most recent messages. it's out of date and doesn't work as it should right now.
Posts: 14
thanks for the response. Now I'm trying to get kirill's tutorial to work. I made the tutorial2 module as instructed and now I get this error when I browse to g2_view=tutorial2:MyPage. Any ideas why this is happening?
thanks,
Kevin
Error
An error has occurred.
Back to the Gallery
Error Detail -
Error (ERROR_BAD_PARAMETER) : /homepages/41/d88620562/htdocs/wsc88620570/gallery2/modules/core/classes/../../../modules/core/Navigation.inc
in modules/core/classes/GalleryView.class at line 158 (gallerystatus::error)
in modules/tutorial2/MyPage.inc at line 47 (galleryview::loadview)
in modules/core/classes/GalleryTheme.class at line 688 (mypageview::loadtemplate)
in modules/core/classes/GalleryView.class at line 285 (matrixtheme::loadtemplate)
in main.php at line 287 (mypageview::doloadtemplate)
in main.php at line 87
in main.php at line 80
System Information
Gallery version 2.0
PHP version 4.3.10 cgi
Webserver Apache/1.3.33 (Unix)
Database mysql 4.0.25-standard-log
Toolkits NetPBM, Gd
Operating system Linux infong 2.4 #1 SMP Mon Aug 9 10:21:08 CEST 2004 i686 unknown
Browser Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
Posts: 32509
maybe the tutorial is out of date or you did something else wrong, because modules/core/Navigation.inc just doesn't exist.
Posts: 565
Is the StaticHTML module now dead, in mothballs or about to be re-awakened?
Posts: 4
This is something that would be very useful to me also. I'm running a released version of G2 with CoreApi 6.8 and ModuleApi 2.0.
Is there anyone who can tweak the HTML module to operate correctly with the current version?
Thanks in advance,
J.
Posts: 17
To make this work module work with your version of G2, all you have to do is go into the html module folder and edit the module.inc file.
Just edit these lines:
$this->setRequiredCoreApi(array(6, 8));
$this->setRequiredModuleApi(array(2, 0));
It should work fine then.
Posts: 565
Well, the StaticHTML module's modification 'works' if by that you mean 'allows itself to be installed'. Something like the rpm Linux command line switch --force (it works but it overides all the built in checks).
I wonder if this has happened here... looking within the StaticHTML module it would seem that I should expect to see linker instances of 'My Stuff' and/or 'My Page' but I haven't found any such yet.
Is there anything else to be done, or have I overcustomised everything here to the point that I can't see the effects of an activated StaticHTML module?
Posts: 565
Does anyone have the StaticHTML module properly running?
Posts: 5
im a complete newbie, but would this work as a workaround?:
use the current out of date staticHTML module(with $this->setRequiredCoreApi(array(6, 8));
$this->setRequiredModuleApi(array(2, 0)) inserted), and simply add a link to /main.php?g2_view=staticHTML:MyPage in the sidebar.tpl file of your theme
Posts: 565
My theme doesn't use the sidebar.
Posts: 8601
i think you can still apply the concept of that nice suggestion..
Posts: 565
mcnnr3----thank you for taking the time to examine the issue and also for articulating what might be a helpful workaround. However I was unable to get your suggestion to work;~/
mindless----staticHTML module has seemingly been abandoned by its author (Gallery's inventor no less). The Wiki assists by pointing to this very thread. The actual staticHTML module has to be hot-wired in two seminal areas for it to even be recognised by G2 (ie as being valid for installation). It's provenance for survival across G2 updates/upgrades doesn't look promising. I don't have a sidebar and so put a simple link in the description of the top level album. The latter of which is what I am using instead of a relatively static 'front page'. Accessing that link leads to an error...
I am aiming to code my site so that G2 replaces the aging osCommerce code that I tweaked at great effort a year or two ago. I'm not a programmer, I just see pictures. These (staticHTML) links were to be aimed at spyders' indexation. Short-lived modules supporting those static links won't be helpful establishing a newly coded site. Is there something I can do to ameliorate this situation... other than articulating that 'My theme doesn't use the sidebar'?
----best wishes, Robert
[postedit: make URL generic]
Posts: 32509
yeah, we need to update this module at some point...
btw: it's "spider" and not "spyder" (just pointing this out since you're writing spyder in all your posts )
Posts: 565
Entirely deliberate with the emphasis on spy.
Much like as in M$ with the emphasis on dollars.
Posts: 5
icpix, i was in fact able to get my idea to work. your error message is exactly what i see when i mistype the name of the module in the url. i believe the syntax for the link should be "/main.php?g2_view=[modulename]:[templatepage]". if you downloaded the html.tar.gz module in the beginning of this thread, then modulename would be html and template page would be HtmlPage (cap sensitive). check that your naming of everything is correct and let me know if that works.
Posts: 565
mcnnr3---- Have just come in and experimented. You are 100% correct in your assessment and its remedy - well done;~) However I now have a newspaper deadline to meet but I will return to the thread.
----best wishes, Robert
Posts: 565
I now have an info (static) page up;~) To scale this up for more separate pages I assume I need to add more modules albeit with differing names, or is there a more ergonomic programming type solution within the existing module?
----best wishes, Robert