Has anybody made an implementation to display the editors in each category linked to their e-mail address (just like dmoz)?
Aug 24, 2000, 10:09 AM
Veteran (17240 posts)
Aug 24, 2000, 10:09 AM
Post #2 of 4
Views: 2850
I don't think it would be too hard. Of course, you would have to use the dynamic mode via page.cgi to show the editors.
Here is the logic you could use to do this:
1) Within the sub generate_category_page, you would have to use the SELECT function to select the CategoryID from the Editors table and also select the corresponding UserID from the Users table.
2) Then you would have to define a variable for the Editor information, something like $OUT{editorinfo}.
3) Then in your category.html file, add the following tag:
<%editorinfo%>
Just a matter of hacking (trial and error) the page.cgi script and template file.
Regards,
Eliot Lee
Here is the logic you could use to do this:
1) Within the sub generate_category_page, you would have to use the SELECT function to select the CategoryID from the Editors table and also select the corresponding UserID from the Users table.
2) Then you would have to define a variable for the Editor information, something like $OUT{editorinfo}.
3) Then in your category.html file, add the following tag:
Code:
<%editorinfo%>
Just a matter of hacking (trial and error) the page.cgi script and template file.
Regards,
Eliot Lee
Aug 24, 2000, 12:11 PM
Veteran / Moderator (6956 posts)
Aug 24, 2000, 12:11 PM
Post #3 of 4
Views: 2835
Eliot...
Why would it have to be dynamic?
It could be added to the nph-build.cgi file, so that each time a category is built, the editors database is querried right at the time the Links database is queried, and you just put/format the editors into a new variable <%Editors%> to be used in the templates.
This is a really cool idea, and I may implement it! I'm working on a site for someone that wants to make use of editors, so enabling this functionality (by a flag in the Links.pm file) should not be hard. The reason for that, is if you don't want to enable editors, you'll save the cpu cycles, sort of like the Days_Old variables.
## do the sql stuff to get the editors
## do the format stuff to create the %OUT{Editors} variable
}Then, you could put a field in the category record to "enable editors", which would allow you to turn off (or on) this display for specific categories. (There are multiple reasons to want to do this.)
This would work even in the absence of category-specific templates, so that you could put a line in the category.html template:
<%if Editors%>
<%Editors%>
<%endif%>
<%endif%>Sounds like something I could do in short order....
(Of course with a site with purely category-specific templates, you wouldn't need that, but most sites are _not_ done this way, so for those who were wondering, yes, you could, but the two flags above are probably more portable and widely useful.)
http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/
Why would it have to be dynamic?
It could be added to the nph-build.cgi file, so that each time a category is built, the editors database is querried right at the time the Links database is queried, and you just put/format the editors into a new variable <%Editors%> to be used in the templates.
This is a really cool idea, and I may implement it! I'm working on a site for someone that wants to make use of editors, so enabling this functionality (by a flag in the Links.pm file) should not be hard. The reason for that, is if you don't want to enable editors, you'll save the cpu cycles, sort of like the Days_Old variables.
Code:
if ($LINKS{enable_editors} { ## do the sql stuff to get the editors
## do the format stuff to create the %OUT{Editors} variable
}
This would work even in the absence of category-specific templates, so that you could put a line in the category.html template:
Code:
<%if enable_editors%> <%if Editors%>
<%Editors%>
<%endif%>
<%endif%>
(Of course with a site with purely category-specific templates, you wouldn't need that, but most sites are _not_ done this way, so for those who were wondering, yes, you could, but the two flags above are probably more portable and widely useful.)
http://www.postcards.com
FAQ: http://www.postcards.com/FAQ/LinkSQL/