This topic is locked

Bootstrap Theme Selector for ASPrunner.net

2/11/2019 7:10:42 PM
ASPRunner.NET General questions
D
DennisB author

I tried to modify an example I found on the forum that was written for PHPrunner but wasn't successful. Has anyone been able to set this up for ASPRunner.net ?
I just started using version 10 after not using ASPRunner for quite a while.

admin 2/12/2019

Themes work exactly the same way in PHPRunner and ASPRunner.NET. You need to explain what exactly you tried and what exactly didn't work.

D
DennisB author 2/12/2019



Themes work exactly the same way in PHPRunner and ASPRunner.NET. You need to explain what exactly you tried and what exactly didn't work.


I found this link on the PHP forum: Bootstrap Selector
I create the tables, copied files, etc. But the code seemed not to work with .net
$sql = "SELECT theme AS mytheme FROM theme_chooser WHERE status = 'ACTIVE'";

$rs = CustomQuery($sql);

$data = db_fetch_array($rs);

$_SESSION["MyCoolTheme"] = $data["mytheme"];
guessing the $ were a problem I tried:
sql = "SELECT theme AS mytheme FROM theme_chooser WHERE status = 'ACTIVE'";

rs = CustomQuery(sql);

data = db_fetch_array(rs);

x_SESSION["MyCoolTheme"] = data["mytheme"];
still no joy
I also think I am missing something in the layoutbuilder.cs changes
I think this would work and be pretty cool if I figure the .php to .net changes I need to make.

D
DennisB author 2/14/2019



I found this link on the PHP forum: Bootstrap Selector
I create the tables, copied files, etc. But the code seemed not to work with .net
$sql = "SELECT theme AS mytheme FROM theme_chooser WHERE status = 'ACTIVE'";

$rs = CustomQuery($sql);

$data = db_fetch_array($rs);

$_SESSION["MyCoolTheme"] = $data["mytheme"];
guessing the $ were a problem I tried:
sql = "SELECT theme AS mytheme FROM theme_chooser WHERE status = 'ACTIVE'";

rs = CustomQuery(sql);

data = db_fetch_array(rs);

x_SESSION["MyCoolTheme"] = data["mytheme"];
still no joy
I also think I am missing something in the layoutbuilder.cs changes
I think this would work and be pretty cool if I figure the .php to .net changes I need to make.


Build gives errors like: The name 'sql' does not exist in the current context - so it takes more than removing the $ signs.
I really would like to be able to include the ability for end users to choose their bootstrap theme they prefer but I haven't found how to implement this in ASPRunner.net
As the reply "Themes work exactly the same way in PHPRunner and ASPRunner.NET." may be correct, but does not help me to implement the same thing, a Theme Selector.

  • I think I will post in a PHPrunner forum to see if I can get some help there.

T
Tim 2/15/2019

Hi Dennis,
I'm not sure I fully understand what you are trying to do, or that I know how to help, but I can take a stab at changing your code to work in ASP.Net.
Here is what you had:
sql = "SELECT theme AS mytheme FROM theme_chooser WHERE status = 'ACTIVE'";

rs = CustomQuery(sql);

data = db_fetch_array(rs);

x_SESSION["MyCoolTheme"] = data["mytheme"];
It looks to me like it should be this:
string sql = "SELECT theme AS mytheme FROM theme_chooser WHERE status = 'ACTIVE'";

XVar rs = tDAL.CustomQuery(sql);

XVar data = CommonFunctions.db_fetch_array(rs);

XSession.Session["MyCoolTheme"] = data["mytheme"].ToString();
Hope this helps.

Good luck!

Tim

D
DennisB author 2/15/2019



Hi Dennis,
I'm not sure I fully understand what you are trying to do, or that I know how to help, but I can take a stab at changing your code to work in ASP.Net.
Here is what you had:
sql = "SELECT theme AS mytheme FROM theme_chooser WHERE status = 'ACTIVE'";

rs = CustomQuery(sql);

data = db_fetch_array(rs);

x_SESSION["MyCoolTheme"] = data["mytheme"];
It looks to me like it should be this:
string sql = "SELECT theme AS mytheme FROM theme_chooser WHERE status = 'ACTIVE'";

XVar rs = tDAL.CustomQuery(sql);

XVar data = CommonFunctions.db_fetch_array(rs);

XSession.Session["MyCoolTheme"] = data["mytheme"].ToString();
Hope this helps.

Good luck!

Tim


Thanks, Tim
This now compiles. The final piece of the puzzle for me seems to be changing the file layoutbuilder.cs - has a similar line on line number 50.
t_layout.version = ##@layout.version##;
here I will try

t_layout.version = XSession.Session["MyCoolTheme]";
no luck
I then tried replacing a couple more lines, but still no luck, so I think I will move on. I opened up the Project in Visual Studio and used Find for "United" the theme I chose initially and found tons of instances so I think what I was trying to do will not work. The idea was to let anyone logging in to the site to choose a theme. Some people might like Darkly and others would prefer something lighter like yeti. I was imagining something like a language selector but for themes.
Anyway, thanks again, Tim. I really appreciate it.
Dennis