Welcome to WebmasterWorld Guest from 34.229.194.198

Forum Moderators: ocean10000

Message Too Old, No Replies

ASP.net Cms page title issue

I'm developing a cms system and having problems setting page title.

     
9:05 am on Jun 1, 2009 (gmt 0)

New User

10+ Year Member

joined:July 12, 2007
posts: 26
votes: 0


Hi,

basically i'm developing my own cms in ASP.NET this has proven to be a huge learning curve, i have done several full scale CMS projects in PHP (not PHP OOP). so its taken abit to think in the altered manner that is required.

However the system currently works as follows:

User hits homepage - default boltons and modules are fired.
user hits a link to go to a content module page.
the url is apended i.e:

[localhost...]

default calls the site class, splits out the url.
default then calls the content module passing in the pageid.

content code is called via Server.Execute();
content module creates its own site class for specific tasks.

now the default module can write to the page header, the site class holds a get/set method to get and write the page header.

however heres my issue,

default creates an instance of site
content creates an instance of site

each write to there own instance of site. so only one will show the correct title, which happens to be default as it sets the page title at the end of the page_load method.

i'm currently looking for a simple and efficient method of multiple modules and boltons reading and writing to the same page title via a method in the site class.

i've looked at XML (it worked) but thats a cop-out IMO, i've thought about using a session varible, that would work (not tested as currently sat at work so no where near my home pc)

So can anyone point me in the right direction at all?

Thanks for reading"

2:46 pm on June 1, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 24, 2005
posts:965
votes: 0


Once you've called Server.Execute, you've lost a lot of page context because you've passed on to a new page.

You really should look at doing whatever you want to do without using Server.Execute.

To set the page title, you need to set the Page.Title property. If you are doing this within a control, you can access this via...

HttpContext.Current.Page.Title

5:52 am on June 2, 2009 (gmt 0)

New User

10+ Year Member

joined:July 12, 2007
posts: 26
votes: 0


is there a way to do what i'm doing without using Server.Execute?

basically default loads and runs all modules via whatever is in the query string, bolt ons are also loaded the same as modules but instead of query string thats down to site config/module config.

i'm setting the site up kind of like plug and play, drop the module in and its ready to use on default conifiguration.

thanks for the Page.Title property, i knew of that.

Currently, with the way i've built the system so far, a session varible would probably be the best answer, to fit my model, however, i'd like to avoid that.

so if there is a better solution to this without having to directly link to the modules/boltons, please point me in the right direction.

1:51 pm on June 2, 2009 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 24, 2005
posts:965
votes: 0


I'm struggling to see exactly what you are doing.

You're going to have to explain what you mean by "bolt-ons" and "modules". These are not standard terms in the programming world. You need to explain what these things are before I can understand what you're trying to do.

2:14 pm on June 2, 2009 (gmt 0)

New User

10+ Year Member

joined:July 12, 2007
posts: 26
votes: 0


i know there not standard names in the world of development.

a Bolt on in this case is an addition to a page, a login box enclosed in div tags, this bolts onto the page without affecting other parts just extending functionality.

a module is the main purpose of that section of the site.
i.e. a module could be a ecommerce system or a blog or a news system etc.

a bolton could be a login box with user statistics.

so if a user links to default.aspx?content&pgid=1

they could see the terms and conditions page.

but if they link to

default.aspx?shop&display=tops&pg=2

they could see the ecommerce module, displaying all the tops in page 2.

a module holds all the logic, configs,images etc that its requires. default.aspx just simply points to it. The module then access's any of the classes that give access to site features, themes, users, groups etc.

i may be going at this all the wrong way, i've come from a php background with some minor OOP. So for me this is a on going project that will fully intregrate me into .net etc.

10:02 am on June 9, 2009 (gmt 0)

New User

10+ Year Member

joined:July 12, 2007
posts:26
votes: 0


Well i've found a solution that works.

As stated i am very much learning as i go along, well i stumbled across a tutorial on using class Current, and storing it in a session varible (might not be the best solution) but by doing this i have been able to call the same class, without defining a new one.

which has allowed each page to be execute the ability to access the same varibles that i am working with, meaning i am able to alter the title without an issue.

Thanks for all the help provided!

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members