Is it possible to pass a variable (username) to a page ?
Posted: 17 August 2006 07:00 AM   [ Ignore ]  
Grad Student
Rank
Total Posts:  53
Joined  07-17-2006

Hi,
I plan to have a page that list all weblog contributions of each user.

To do this, I plan to build a simple page that list entries from all weblog with parameter username=“x”.
Where x should be the variable passed from the previous page.
For example on the frontpage, I can see an article with authorname. When user click on authorname, it would be a link that the next page would use to add it to username=“x”.

Is this possible ? If yes how ?

Thanks in advance,
Brakkar

 Signature 

Brakkar
Commercial license owner

Profile
 
 
Posted: 17 August 2006 07:55 AM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004

Use URL segments, something like http://example.com/index.php/display_author/steven/ and then use {segment_2}.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 17 August 2006 08:00 AM   [ Ignore ]   [ # 2 ]  
Grad Student
Rank
Total Posts:  53
Joined  07-17-2006

Ok,
so if what I understand is correct:

I would have created a template called “display_author” .

When going to http://example.com/index.php/display_author/anyname/ , even if the template “anyname” doesn’t exist, it will use the previous segment for template (which exists) “display_author” . In display author, any {segment_2} code will be replaced by the value of anyname.

Is this correct ?

Cordially,
Brakkar

 Signature 

Brakkar
Commercial license owner

Profile
 
 
Posted: 17 August 2006 08:05 AM   [ Ignore ]   [ # 3 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15368
Joined  05-15-2004
Brakkar - 17 August 2006 08:00 AM

I would have created a template called “display_author”.

Yes, or anything else. Could be another URL segment, in fact. But let’s assume it’s a template. So to cover everything, you should perhaps include a templategroup. http://example.com/index.php/site/display_author/anyname/.

When going to http://example.com/index.php/display_author/anyname/ , even if the template “anyname” doesn’t exist, it will use the previous segment for template (which exists) “display_author” . In display author, any {segment_2} code will be replaced by the value of anyname. Is this correct ?

Why don’t you just try it? URL segments are explained in the userguide in quite some detail.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64905 Total Logged-in Users: 52
Total Topics: 81848 Total Anonymous Users: 27
Total Replies: 440045 Total Guests: 235
Total Posts: 521893    
Members ( View Memberlist )