cheers
Garth
Hi Garth, Attached is a file which demonstrates how to do an ebay style navigation in Witango as described by Nicholas below. There is only a small piece of extra code required - I have included comments in the file but basically a limit is set on the number of results to be returned and from that the total number of pages is calculated with a simple for loop to show the |1| |2| |3| stuff.This could be modified to work like the google (Gooooooogle) search results navigation which is similar..... I would have liked to make this ready to go and set up a resultset to demonstrate on - this wasn't possible though as in the search I needed to show where the limit (@@request$limit) and start (<@ARG _start>) variables are used... Also can I make the suggestion of implementing this with the use of a custom tag - that way anytime you want this functionality all you need to do is add 2 lines of code! - If anyone needs to know how to do this I can post a solution/instructions. Finally the attached will only work with version 5 server (which I might add is very reliable and stable) ....if necessary I can post a taf that will work with earlier versions. Regards, JJ --- Garth Penglase <[EMAIL PROTECTED]> wrote:I'm interested in how best to do this in Witango Garth >Hi Nicholas, > >Why does it have to be done in Javascript anyway? It >can be done relatively straight forward with Witango >and still look exactly the same to the user as the >Javascript you've given below. > >If you change your mind let me know and I can describe >how to do it in Witango. > >JJ > > > >--- Nicholas Froome <[EMAIL PROTECTED]> wrote: >> I posted a while ago about generating page numbers >> eBay-style for multiple result pages. I'd rather do >> this in javascript on a per-page basis than do it >> with Witango, and this is as far as I've got: >> >> <HEAD> >> >> <SCRIPT LANGUAGE="JAVASCRIPT"> >> function GoToPage( id ) >> { >> window.location = ( >> 'http://www.bolide.co.uk/actions/image.taf?link=&start=' >> + id); >> } >> </SCRIPT> >> >> </head> >> >> <BODY> >> >> <!----------------- nav bar starts here >> ------------------> >> >> <a href="javascript: GoToPage('1');">1</A> | <a >> href="javascript: GoToPage('11');">2</A> | <a >> href="javascript: GoToPage('21');">3</A> >> >> <!------------------ nav bar ends here >> -------------------> >> >> etc, etc >> >> What I'd like to do is to calculate the number> of > >> pages from <@TOTALROWS> / <@NUMROWS>, round this > >> total up, then use javascript to populate the > nav > >> bar automagically with the right numbers, and>> calculate the record number to start from from >> <@NUMROWS> >> >> The id number is the page number, and the start >> record = ((page number x <@NUMROWS>)-(<@NUMROWS>-1)) >> >> The final wrinkle would be to make the current page >> number bold >> >> >> >> I know I can't do the javascript - can anyone help? >> I'll post the completed, tested code back to the >> list. The final results would be applicable across >> the board for any dynamically-generated pages >> ________________________________________________________________________ >> TO UNSUBSCRIBE: send a plain text/US ASCII email to >> [EMAIL PROTECTED] >> with unsubscribe witango-talk in the >> message body > > >__________________________________________________ >Do you Yahoo!? >Yahoo! Mail Plus - Powerful. Affordable. Sign up now. >http://mailplus.yahoo.com ________________________________________________________________________ >TO UNSUBSCRIBE: send a plain text/US ASCII email to> [EMAIL PROTECTED]> with unsubscribe witango-talk in the message body --________________________________________________________________________TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED] with unsubscribe witango-talk in the message body
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
Content-Type: text/xml; name="ebay.taf"
Content-Description: ebay.taf
Content-Disposition: inline; filename="ebay.taf"
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE TAF SYSTEM "tango.dtd" >
<TAF Version="0x02000002">
<Comments>Demonstration of ebay type navigation...</Comments>
<!--Main program-->
<Program>
<ActionRef Ref="Assign_the_limit" />
<ActionRef Ref="IfForm">
<ActionRef Ref="Form" />
</ActionRef>
<ActionRef Ref="ElseIfList">
<ActionRef Ref="RecordList" />
</ActionRef>
<ActionRef Ref="ElseError">
<ActionRef Ref="InvalidFunction" />
</ActionRef>
<ActionRef Ref="Readme_dot_txt" />
</Program>
<!--Program actions-->
<Actions>
<ResultAction ID="Assign_the_limit" Sig="null">
<ResultsOutput Ref="Assign_the_limit.Results" />
</ResultAction>
<IfAction ID="IfForm" Sig="if " Expanded="True">
<Expression><![CDATA[('<@ARG _function>'='sform') or (!LEN('<@ARG _function>'))]]></Expression>
<ExpressionInfo>
<ExpLeft><![CDATA[<@ARG _function>]]></ExpLeft>
<ExpRight>sform</ExpRight>
<Operator>iseq</Operator>
</ExpressionInfo>
<ExpressionInfo>
<ExpLeft><![CDATA[<@ARG _function>]]></ExpLeft>
<ExpRight />
<Conjunction>or </Conjunction>
<Operator>iemp</Operator>
</ExpressionInfo>
</IfAction>
<ResultAction ID="Form" Sig="null">
<ResultsOutput Ref="Form.Results" />
</ResultAction>
<ElseIfAction ID="ElseIfList" Sig="elif" Expanded="True">
<Expression><![CDATA[('<@ARG _function>'='list')]]></Expression>
<ExpressionInfo>
<ExpLeft><![CDATA[<@ARG _function>]]></ExpLeft>
<ExpRight>list</ExpRight>
<Operator>iseq</Operator>
</ExpressionInfo>
</ElseIfAction>
<SearchAction TotalRows="True" UseDevelopmentDataSource="TRUE" DSID="MyDataSource" DeploymentDSID="MyDataSource.1" ID="RecordList" Sig="srch">
<Tables>
<TableName>userstable</TableName>
</Tables>
<DataDictionary>
<Column DataType="long" ColumnType="0">
<TableName>userstable</TableName>
<ColumnName>User_ID</ColumnName>
</Column>
<Column DataType="vcha" ColumnType="0">
<TableName>userstable</TableName>
<ColumnName>Username</ColumnName>
</Column>
</DataDictionary>
<SearchColumns>
<ColumnReference>
<TableName>userstable</TableName>
<ColumnName>User_ID</ColumnName>
</ColumnReference>
<ColumnReference>
<TableName>userstable</TableName>
<ColumnName>Username</ColumnName>
</ColumnReference>
</SearchColumns>
<OrderColumns>
<OrderColumn>
<Ascending>True</Ascending>
<TableOwner />
<TableName />
<ColumnName>1</ColumnName>
</OrderColumn>
</OrderColumns>
<Criteria>
<CriteriaItem>
<TableName>userstable</TableName>
<ColumnName>User_ID</ColumnName>
<Operator>iseq</Operator>
<Value><![CDATA[<@ARG User_ID>]]></Value>
<QuoteValue>false</QuoteValue>
<IncludeIfEmpty>false</IncludeIfEmpty>
</CriteriaItem>
<CriteriaItem>
<Conjunction>and </Conjunction>
<TableName>userstable</TableName>
<ColumnName>Username</ColumnName>
<Operator>swth</Operator>
<Value><![CDATA[<@ARG Username>]]></Value>
<QuoteValue>true</QuoteValue>
<IncludeIfEmpty>false</IncludeIfEmpty>
</CriteriaItem>
</Criteria>
<StartRow><![CDATA[<@ARG _start>]]></StartRow>
<MaxRows>@@request$limit</MaxRows>
<ResultSet Type="Array" />
<ResultsOutput Ref="RecordList.Results" />
<NoResultsOutput Ref="RecordList.NoResults" />
</SearchAction>
<ElseAction ID="ElseError" Sig="else" Expanded="True" />
<ResultAction ID="InvalidFunction" Sig="null">
<ResultsOutput Ref="InvalidFunction.Results" />
</ResultAction>
<ResultAction ID="Readme_dot_txt" Sig="null">
<ResultsOutput Ref="Readme_dot_txt.Results" />
</ResultAction>
</Actions>
<!--Data sources-->
<DataSources>
<DataSource ID="MyDataSource">
<DSType>ODBC</DSType>
<DSN>MyDataSource</DSN>
<DBMS />
<Host>MyDataSource</Host>
<Database />
<UserInfo Encrypted="True">
<UserName>set%20me%20u%D5%C3%8A%07%F5%E1%AD%AF</UserName>
<Password>set%20me%20u%D5%C3%8A%07%F5%E1%AD%AF</Password>
</UserInfo>
</DataSource>
<DataSource ID="MyDataSource.1">
<DSType />
<DSN>MyDataSource</DSN>
<DBMS />
<Host>MyDataSource</Host>
<Database />
<UserInfo Encrypted="True">
<UserName />
<Password />
</UserInfo>
</DataSource>
</DataSources>
<!--Output blocks-->
<Outputs>
<Output ID="Assign_the_limit.Results" Type="HTML"><![CDATA[<@comment>
Assign how many results you want to appear on each page
This in turn will determine on how many pages there are.....
</@comment>
<@assign request$limit value="5">]]></Output>
<Output ID="Form.Results" Type="HTML"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Search</TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ACTION="<@CGI><@APPFILE>?_function=list&<@UserReferenceArgument>&_start=1">
<TABLE BORDER=0>
<TR VALIGN=TOP ALIGN=LEFT> <TD>
User ID:
</TD>
<TD>
<INPUT NAME="User_ID" TYPE=TEXT SIZE=10 MAXLENGTH=30 VALUE="">
</TD>
</TR>
<TR VALIGN=TOP ALIGN=LEFT> <TD>
Username:
</TD>
<TD>
<INPUT NAME="Username" TYPE=TEXT SIZE=40 MAXLENGTH=40 VALUE="">
</TD>
</TR>
</TABLE>
<INPUT TYPE=SUBMIT VALUE="Find"> <INPUT TYPE=RESET VALUE="Reset Values">
</FORM>
</BODY>
</HTML>
]]></Output>
<Output ID="RecordList.Results" Type="HTML"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Matching Records</TITLE>
</HEAD>
<BODY>
<TABLE BORDER=0>
<TR VALIGN=TOP ALIGN=LEFT>
<TD>
<B>User ID</B>
</TD>
<TD>
<B>Username</B>
</TD>
</TR>
<@ROWS>
<TR VALIGN=TOP>
<TD>
<A HREF="<@CGI><@APPFILE>?_function=detail&userstable_uid1=<@COLUMN "userstable.User_ID" ENCODING=URL>&<@UserReferenceArgument>"><@COLUMN "userstable.User_ID"></A>
</TD>
<TD>
<@COLUMN "userstable.Username">
</TD>
</TR>
</@ROWS>
</TABLE>
<@comment>
Start of Ebay type navigation
</@comment>
<p>
<@FOR START="1" STEP="@@request$limit" STOP="<@TOTALROWS>">
<@assign request$page value="<@calc '@@request$page+1'>">
<@comment>
If the page shown is the one we are on make the page number bold and remove the link....
</@comment>
<@if '<@STARTROW>=<@currow>'>
| <b>@@request$page</b>|
<@else>
<@comment>
otherwise add a link and set where the start should be....
</@comment>
| <A HREF="<@CGI><@APPFILE>?_function=list&_start=<@currow>&<@UserReferenceArgument>">@@request$page</A>|
</@if>
</@FOR>
</p>
<@comment>
End of Ebay type navigation
</@comment>
</BODY>
</HTML>
]]></Output>
<Output ID="RecordList.NoResults" Type="HTML"><![CDATA[<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>No Matching Records</TITLE>
</HEAD>
<BODY>
<H2>No Matching Records</H2>
<P>No records match your search criteria.</P>
<P><A HREF="<@CGI><@APPFILE>?<@UserReferenceArgument>">Search Again</A></P>
</BODY>
</HTML>]]></Output>
<Output ID="InvalidFunction.Results" Type="HTML"><![CDATA[<B>Error: Invalid function value specified in CGI call.</B>]]></Output>
<Output ID="Readme_dot_txt.Results" Type="HTML"><![CDATA[<@comment>
Before this will work you will need to set up the appropriate datasource
I would have liked to make this ready to go and set up a resultset to demonstrate on -
this wasn't possible though as in the search I needed to show where the limit
and start variables are used...
In the results of the search return the columns you have selected.
Nothing else needs to be done as the ebay part of the bottom will work as long as there
are results returned
JJ Smith - no copyright - use whenever, wherever.....
Comments/Suggestions to [EMAIL PROTECTED]
</@comment>
]]></Output>
</Outputs>
</TAF>
--
________________________________________________________________________
TO UNSUBSCRIBE: send a plain text/US ASCII email to [EMAIL PROTECTED]
with unsubscribe witango-talk in the message body
