Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Would it be possible to include php code? MSSQL Connection from basic page?
This discussion is related to the Basic Pages addon.
cbunting99 Texas New
I am using Vanilla but I have a small website, 5 pages but 2 of the pages connect to an mssql server.
Does anyone have any ideas how I could add the simple forms to 2 basic pages along with the connection code for MSSQL? The forms, once submitted, submit to themselves only showing a java script error or confirmation box.
Can this be done?
Thanks for your time,
The BasicPages application prints a textfield from the database to the screen. So you cannot embed code in there. You might want to try ExtraPage.
While BasicPages gives you a nice interface to easily insert and manage static pages into your site, ExtraPage is a blueprint that empowers you to implement extra pages as a plugin. Since it is a plugin, you are not limited what your pages can do: print out static messages, run code inside the Garden framework or even present info from other databases.
With a custom plugin, you may hook into one of the events and execute code fired on page loads. See this discussion for an example: http://vanillaforums.org/discussion/26615/some-text-basic-pages-only-visible-for-logged-in-users/
Add Pages to Vanilla with the Basic Pages app
Custom Pages is another option: http://vanillaforums.org/addon/custompages-plugin
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
I would build a separate PHP script that handled your MSSQL connection stuff outside of Vanilla entirely, with a couple wrapper functions for whatever you're passing to/from it. Then
includethat file in a Vanilla plugin (putting it in a subfolder named
librarywould be the convention) and just call the wrapper functions from the plugin file. That gives you at least a tenuous separation of concerns.
An even better strategy (tho a bit more time consuming) would be to put the MSSQL stuff in a separate app entirely with a basic API, then use Vanilla to ping your API with the data it collects/need.
This isn't a quick project, in my opinion. Without Vanilla plugin experience, I'd set aside several days to work on this.
Thanks guys for all of the replies. I will check out some of the options. If I can figure it out, I'll just have someone else write it.
If you are using basic pages and have some html experience, here is a quick hack that will allow you to include other content, database submission forms, anything really..
When creating a new basic page, make sure the select raw html from the drop down, not the one with line breaks.
Type a title for your new page, but in the body, where you would normally write your content, use the following,
<iframe src="http://yoursite.com/register.php" width="100%" height="800" frameborder="0" scrolling="no"> </iframe>
I actually have a register page and I am not sure how to write a plugin for what I need. but I have created a new directory /forum/acc/ where I put the register scripts for our game.
Using basic pages allows only logged in members to see the pages, and the links show on the top navigation. I've tried a lot of different plugins but so far, this is the only way I can execute outside mssql code within Vanilla..
This is probably a crappy way of doing things, but it works until I can find a better solution.. Just figured I'd share in case anyone else has a simular issue.