1 drp May 01, 2008 23:19
3 drp May 02, 2008 07:04
Thanks for the reply.
What stub page should I use?
Clive
4 afwas May 02, 2008 08:09
If you don't use a stub file simply leave that one blank and if it gives an error fill in 'index' to make index.php.
Good luck
5 drp May 02, 2008 18:23
Sorry, I don't understand. What does the stub file do?
Anyway, I've tried doing what you said, but it says "You haven't defined a source file for this blog!" and when I type in index as the source I get the same thing. I've found something in my root directory called a_stub.php and even tried using that as the source file but, again, I get the same error.
What next?
Thanks,
Clive
6 afwas May 02, 2008 18:53
OK, that's confusing indeed.
You should type in the first box 'index.php' so *with* the .php part. Like so in the second box 'something.html'. Now hit the 'Save' button at the bottom of the page and finally click the 'Generate now!'.
If you don't know what a stub file is, you are likely not using it ;) Therefore you can forget that part.
Good luck
If anything fails, take a copy of the sourcecode.
7 brandonh May 04, 2008 04:33
Instead of this, would it work to have a hack in your skin's index.main.php where an if statement determines whether or not you include your form or display your posts?
just curious, because then you wouldn't have to update your stub file every time you change a widget or something on your page.
or do i completely misunderstand what a stub file is?
8 drp May 04, 2008 14:15
Hmmm. Ok, I've understood the stub file stuff. I can put my form in the stub file and use that. Here's the problem with doing that: anytime I update anything, such as widgets (thanks, brandonh) or categories, I will need to update the stub file accordingly. Also, even though I am logged in to my blog, the stub file isn't. And then, what is the difference between making a stub file and copying the source if a page anyway?
I'm thinking of trying the hack in the index.main.php, but not quite sure which route to take.
Any recommendations? I'm currently thinking of passing a couople of variables through the url, one for the IF statement and one for the address of the include containing the form. Does that sound about right?
Clive
9 brandonh May 04, 2008 14:41
your link to your form
http://www.yoursite.com/index.php?formview=yes
now you can have this section of code to replace the post area of your page...
<?php
if ($_GET['formview'] != 'yes')
{//show all the normal post stuff you would see.
//doing it this way also uses b2's normal stuff to deter people trying to
//change your url variable names
// --------------------------------- START OF POSTS -------------------------------------
((((((((((all the normal post stuff here))))))))))))))))))))))))))
} // ---------------------------------- END OF POSTS ------------------------------------
}//end of the if that checks if your form should be displayed
else
{//show your form
include 'formdisplay.php';
}//end of the form display
?>
Now you would just need to appropriately design your styles in the separate formdisplay.php file. you also may want to consider having your form action be php_self and then add into the check at the top
if ($GET_['formview'] != 'yes' || $_POST['formbutton'])
i haven't tested anything so a css master or a b2 php master will be able to correct me on minor details or security issues that may come up.
good luck!
10 drp May 04, 2008 14:50
Slightly different to what I was thinking:
if (isset($_GET['manualpage'])) {
// show manual page, eg form
include "$_GET['manualpage']";
} else {
// show posts
}
Do I need to worry about security when passing a page address through the url? I prefer mine, because I can then make more pages than just the form, and simply link to them by inserting their filename in the url with ?manualpage=filename. I will be processing the form script on the same page, too, so will do something like you suggested.
Clive
11 brandonh May 04, 2008 15:44
if that was the way, couldn't someone change the url to include whatever page they wanted? by the time you include your form page, index.php has already made all the connections, so someone could write his own page which could wipe your blog clean.
http://yoursite.com/index.php?manualpage=mypageinsteadofyours
then if (isset($_GET['manualpage'])) returns true and your blog would include my manually typed in page.
i'm not saying anyone is necessarily trying to attack you, but b2 does a pretty good job of covering security risks like that, which is why i did it my way.
i think i see what you're trying to do, so maybe you could have formdisplay.php contain more if statements which cover the multiple forms you may want to display. that way, if the formview variable isn't exactly what it's required to be, your posts would be displayed instead of a different form. if formview == yes, but the manualpage variable isn't one of your assigned names, you can display some kind of error, instead of some stranger's file.
12 edb May 04, 2008 16:36
Is there a reason why using a custom disp value won't work? I mean, I do quite a few custom forms that embed seamlessly into b2evolution using the "disp=foo" feature, including of course telling my main.php file what file it displays when disp is "foo" or whatever else I may want.
You make the custom page, you edit your index.main.php file, it works. Seems like an easy idea?
13 drp May 04, 2008 17:01
What is this disp="foo" feature?
I've had a look at this:
http://forums.b2evolution.net/viewtopic.php?p=54648&sid=7726e302138a387c4118900435d9213e
but there is no _dispatch.inc.php file in my skims folder.
Clive
14 edb May 04, 2008 17:19
That's because you are looking at a hack for an old version. Check out http://forums.b2evolution.net/viewtopic.php?t=14046&highlight=custom+disp in the FAQs forum. You can also see a hack that uses it at http://forums.b2evolution.net/viewtopic.php?t=14796 for a working example that uses forms to do stuff.
:D ?
15 drp May 04, 2008 17:33
I think that'll do it.
Thanks for the help everyone,
CLive
16 brandonh May 05, 2008 02:36
yeah that was way easier. it's just that my knowledge is not much beyond b2evo 101.
Go to Dashboard -> Blog settings -> CHOOSE A BLOG -> Advanced and you will find a way to generate a static page.
Good luck