Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 17, 2012, 02:53:20 AM
Home
Forum
Documentation
Search
Help
Login
Register
Gaia Framework for Adobe Flash
>
Forum
>
Support
>
Feature Requests
(Moderators:
Nemo
,
Ramiro
) >
Use page id in Pages.as (instead of page route)
Pages: [
1
]
« previous
next »
Print
Author
Topic: Use page id in Pages.as (instead of page route) (Read 1300 times)
TyZ
Gaia User
Posts: 62
Temple - http://templelibrary.googlecode.com/
Use page id in Pages.as (instead of page route)
«
on:
April 16, 2010, 08:32:43 AM »
I work for an international company and most of the time I make non-English websites. So the "title" and "route" attribute will be non English as well. But the code must always be English. Therefor we use English id's for all pages. When I scaffold the project, Gaia uses the route, and not the id, so all values in Pages.as are non English.
I think the page id's should also be unique and can therefor be used in the Pages.as.
Logged
madsb
Gaia Novice
Posts: 6
Re: Use page id in Pages.as (instead of page route)
«
Reply #1 on:
April 19, 2010, 03:16:20 AM »
While commemorating Steven for the awesome, awesome work on Gaia, I second the request for using page id's in Pages.as instead of the page title when scaffolding.
Logged
Ramiro
Moderator
Gaia Addict
Posts: 861
interactive pragmatism
Re: Use page id in Pages.as (instead of page route)
«
Reply #2 on:
April 19, 2010, 10:47:00 AM »
I understand using the route (or title) instead of the ID is because the id is NOT unique after all. You can have the same ID name as long as they're not siblings. I use the same id within the site.xml a lot.
using the full branch id (separated by underscore or dash) would be a solution, but would not be that easy to read. I recommend renaming the constants to meaningful names and keeping a copy of it if going to scaffold again, or use a different class instead of Pages.as, and update it if you add pages to the site.xml.
I change the site.xml a few times during most projects, so I use a copied class from Pages.as named Routes.as, with meaningful names, and update it when scaffolding again. The actual naming of the class has a little extra advantage with flashdevelop: If start typing "pages" (without the uppercase P) it gives me the autocomplete for the pages package and no the Pages.as. With Routes (or anything different than Pages) I don't have this annoyance
Logged
TyZ
Gaia User
Posts: 62
Temple - http://templelibrary.googlecode.com/
Re: Use page id in Pages.as (instead of page route)
«
Reply #3 on:
April 21, 2010, 06:21:01 AM »
Route isn't unique either. You can reuse the same route without getting an error in Gaia.
Since id is shorten for 'identifier' I think it should be unique. Like it is in other languages like HTML.
Logged
Ramiro
Moderator
Gaia Addict
Posts: 861
interactive pragmatism
Re: Use page id in Pages.as (instead of page route)
«
Reply #4 on:
April 21, 2010, 08:31:29 AM »
A route should be unique, never the less. If not unique, you wouldn't be able to deeplink to a duplicated route-name page.
On the other hand, the id doesn't need to be unique.
Logged
steven
Gaia Author
Administrator
Gaia Evangelist
Posts: 3871
Re: Use page id in Pages.as (instead of page route)
«
Reply #5 on:
April 21, 2010, 10:07:51 AM »
Routes are always unique. It is impossible to have a duplicate route. If you give two pages the same route, the latter page will overwrite the previous one.
Page ids are not unique. Branches are the only true unique identifier since you cannot have two siblings with the same id.
This topic has been discusssed numerous times on the forum. It's not a change that I'm going to make because it's not a change that makes sense.
Logged
Steven Sacks | Gaia Author
Please support Gaia by
donating to the project!
TyZ
Gaia User
Posts: 62
Temple - http://templelibrary.googlecode.com/
Re: Use page id in Pages.as (instead of page route)
«
Reply #6 on:
April 22, 2010, 02:45:11 AM »
If routes should be unique I think Gaia should throw an Error (or at least display a warning) when you use duplicates. Now it is possible to use the same route for different pages.
Logged
steven
Gaia Author
Administrator
Gaia Evangelist
Posts: 3871
Re: Use page id in Pages.as (instead of page route)
«
Reply #7 on:
April 22, 2010, 11:16:49 AM »
No it isn't possible, nor is it logical.
If you have an expectation that one route could take you to two different locations, you haven't got a very good grasp of the universe and should either check into a mental hospital or become a scientist exploring alternate universes where the rules of our universe don't apply.
I'm not going to throw an error that says "One route cannot lead to two places" anymore than I would throw an error that says "Your mother cannot be your sister."
«
Last Edit: April 22, 2010, 11:19:11 AM by steven
»
Logged
Steven Sacks | Gaia Author
Please support Gaia by
donating to the project!
steven
Gaia Author
Administrator
Gaia Evangelist
Posts: 3871
Re: Use page id in Pages.as (instead of page route)
«
Reply #8 on:
April 22, 2010, 11:22:49 AM »
And for the record, choosing ids vs titles vs routes to use in the Pages class is somewhat arbitrary. The bottom line is the pages class is merely a convenient substitute for branches. Since ids are not unique, and as much as I have tried to encourage not duplicating ids, people still do it pretty often, they are not an acceptable shortcut. Titles tend to be more descriptive than routes, so I chose titles as the const names since it makes them more easily identifiable, which is the *only* purpose of the Pages class.
Logged
Steven Sacks | Gaia Author
Please support Gaia by
donating to the project!
TyZ
Gaia User
Posts: 62
Temple - http://templelibrary.googlecode.com/
Re: Use page id in Pages.as (instead of page route)
«
Reply #9 on:
April 23, 2010, 03:19:27 AM »
Displaying a warning should really be helpful. If you work on a big project with a large site.xml with multiple developers it's hard to see if a route is already taken by a page. You get unexpected bugs since deeplinking works incorrect.
You only need to add something like:
if(_routes.hasOwnProperty(page.route)
{
GaiaDebug.warn("Duplicate rout '" + page.route + "'");
}
Inside SiteModel.as (line 262)
This is also very handy if you didn't use routes and the title is used as route (title can be used multiple times).
I could also argue about the mother / sister thing. But that would be a complete different discussion I think
Logged
steven
Gaia Author
Administrator
Gaia Evangelist
Posts: 3871
Re: Use page id in Pages.as (instead of page route)
«
Reply #10 on:
April 06, 2011, 11:36:14 AM »
There's no simple solution to this. Some people use identical titles, some don't. Some people use identical ids, some don't. IMO, titles are more likely to be unique than ids, but YMMV. No matter, what, though, routes are under your total control and you always have the ability to modify the Pages.as file to suit your needs.
Logged
Steven Sacks | Gaia Author
Please support Gaia by
donating to the project!
steven
Gaia Author
Administrator
Gaia Evangelist
Posts: 3871
Re: Use page id in Pages.as (instead of page route)
«
Reply #11 on:
April 09, 2011, 02:41:08 PM »
I have switched to using ids.
Logged
Steven Sacks | Gaia Author
Please support Gaia by
donating to the project!
TyZ
Gaia User
Posts: 62
Temple - http://templelibrary.googlecode.com/
Re: Use page id in Pages.as (instead of page route)
«
Reply #12 on:
April 11, 2011, 02:09:35 AM »
Great!
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Downloads and Information
-----------------------------
=> * Download Gaia *
=> Lessons, Examples, Tips+Tricks, Mods and Utilities
=> Gallery
-----------------------------
Support
-----------------------------
=> General Gaia Support
=> Gaia AS3 Support
=> Gaia AS2 Support
=> Feature Requests
=> Non-Gaia Questions
-----------------------------
International Support
-----------------------------
=> Deutsche
=> Español
=> Français
=> Italiano
=> Português
=> 日本語
TinyPortal v1.0 beta 4 ©
Bloc
Loading...