RedDot <if> statement and querystring

257 views
Skip to first unread message

Andry

unread,
Nov 14, 2011, 6:29:02 AM11/14/11
to RedDot CMS Users
Hi guys,

Has anyone worked with a combination of reddot <if> statement and
querystring before?

I need to create an A-Z index page and page search by category.

something like...

<reddot:cms>
<if>
<query valuea="Context:CurrentIndex.Headline.Substring(Int:0,
Int:1).ToUpper()" operator="==" valueb="<% Response.QueryString("A")
%>"
<htmltext>
<li><a href="<%!! Context:CurrentIndex.GetUrl() !!%>"><
%!! Context:CurrentIndex.Headline !!%></a></li>
<navigation:nextlevel>
</htmltext>
</query>
</if>
</reddot:cms>

Thanks guys... :)

Andry

Tony Gayter

unread,
Nov 14, 2011, 6:33:08 AM11/14/11
to reddot-c...@googlegroups.com
You will need some preexecute tags in there somewhere, I havent tried it but I would start by wrapping the whole thing qither preexecute tags as I font know ig they will work inside the statement (althoguh they do inside htmltext tags)

Richard Hauer

unread,
Nov 14, 2011, 6:37:50 AM11/14/11
to reddot-c...@googlegroups.com
You might have more luck replacing
Response.QueryString("A")
with
System.Web.HttpContext.Current.Request.QueryString("A")


I'm still not sure it will work because the render tags are being executed
in a Windows Service and don't have access to the HttpContext object.
Or that's my guess anyways - worth a try.

Conceptually though you're not really doing the right thing anyway - what
querystring are you trying to read? Runtime? SmartEdit? SmartTree? Preview?
PreExecute? RDExecute? They're all different.
I suspect you're trying to do something you simply can't do and you'd be
better off putting your question to the group by starting with what you're
actually trying to do.

Regards,
Richard Hauer

Hi guys,

something like...

Thanks guys... :)

Andry

--
You received this message because you are subscribed to the Google Groups
"RedDot CMS Users" group.
To post to this group, send email to reddot-c...@googlegroups.com.
To unsubscribe from this group, send email to
reddot-cms-use...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/reddot-cms-users?hl=en.

Tony Gayter

unread,
Nov 14, 2011, 6:43:07 AM11/14/11
to reddot-c...@googlegroups.com
Question, why are you trying to do this in reddot? There is already a search option, is this somethign which you want in the front end?

Andry Poernomo

unread,
Nov 14, 2011, 6:46:30 AM11/14/11
to reddot-c...@googlegroups.com

Hi Tony,

 

Yes, this is going to be for the audience to find pages based on the first letter of the page title...

 

Andry

--

You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group.

To view this discussion on the web visit https://groups.google.com/d/msg/reddot-cms-users/-/4fkfS6ry02kJ.

Tony Gayter

unread,
Nov 14, 2011, 6:50:22 AM11/14/11
to reddot-c...@googlegroups.com
what do you mean by audience though? Ill assume you mean the published site, if so why dont you output the list of pages in xml (for example) and build a page ro read that and do what you want with the results?  Much easier

Andry Poernomo

unread,
Nov 14, 2011, 6:55:58 AM11/14/11
to reddot-c...@googlegroups.com
Hi Richard,

I'm trying to build an A-Z index page. Something like:
http://find.curtin.edu.au/indexaz/index.cfm.

The query string will be on each link from A to Z. Ie. <a
href="?index=A">A</a> <a href="?index=B">B</a> and so on. The page will then
load the following navigation

<reddot:cms>
<if>
<query valuea="Context:CurrentIndex.Headline.Substring(Int:0,

Int:1).ToUpper()" operator="==" valueb="QueryString("index") here">


<htmltext>
<li><a href="<%!! Context:CurrentIndex.GetUrl() !!%>"><%!!
Context:CurrentIndex.Headline !!%></a></li>
<navigation:nextlevel>
</htmltext>
</query>
</if>
</reddot:cms>

The <li> will then be sorted using a javascript.

Doesn't sound like a good plan, does it... Any good advice on how I should
implement this?

Andry

Andry Poernomo

unread,
Nov 14, 2011, 6:59:14 AM11/14/11
to reddot-c...@googlegroups.com

Hi Tony,

 

Yes, what I mean with audience is the web users / visitors.

 

Sounds like a good idea. Can you refer me to a good script that does this?

 

Andry

 

 

From: reddot-c...@googlegroups.com [mailto:reddot-c...@googlegroups.com] On Behalf Of Tony Gayter
Sent: Monday, 14 November 2011 7:50 PM
To: reddot-c...@googlegroups.com
Subject: Re: RedDot <if> statement and querystring

 

what do you mean by audience though? Ill assume you mean the published site, if so why dont you output the list of pages in xml (for example) and build a page ro read that and do what you want with the results?  Much easier

--

You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group.

To view this discussion on the web visit https://groups.google.com/d/msg/reddot-cms-users/-/0KwxIME_YqEJ.

Tony Gayter

unread,
Nov 14, 2011, 7:08:23 AM11/14/11
to reddot-c...@googlegroups.com
 
It is done using content containers and keywords, that way  they can have a number of A-Z pages. Might be an easier way to go if you dont have many categories (An A-Z per category), it uses keywords to pull in pages.
 
But as this is for the external site what you were first trying to achieve wouldnt work anyway as you were running reddot code not published code. You will need to focus on outputting teh code you want to teh final page and not trying to get search functionality working un reddot. As Ricard says, it helps to start with what you're trying to achieve first :)

Andry Poernomo

unread,
Nov 14, 2011, 7:32:58 AM11/14/11
to reddot-c...@googlegroups.com

Hi Tony,

 

It doesn’t load J

 

Andry

 

From: reddot-c...@googlegroups.com [mailto:reddot-c...@googlegroups.com] On Behalf Of Tony Gayter
Sent: Monday, 14 November 2011 8:08 PM
To: reddot-c...@googlegroups.com
Subject: Re: RedDot <if> statement and querystring

 

 

It is done using content containers and keywords, that way  they can have a number of A-Z pages. Might be an easier way to go if you dont have many categories (An A-Z per category), it uses keywords to pull in pages.

 

But as this is for the external site what you were first trying to achieve wouldnt work anyway as you were running reddot code not published code. You will need to focus on outputting teh code you want to teh final page and not trying to get search functionality working un reddot. As Ricard says, it helps to start with what you're trying to achieve first :)

--

You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group.

To view this discussion on the web visit https://groups.google.com/d/msg/reddot-cms-users/-/AuWu-EMGdMkJ.

Richard Hauer

unread,
Nov 14, 2011, 8:18:38 AM11/14/11
to reddot-c...@googlegroups.com
That's totally not going to work. The rendertag is evaluated prior to publication and can'tinteract with client session.

Regards,
Richard.

Sent from my mobile. Sorry if it's brief.



Andry Poernomo <andry.p...@gmail.com> wrote:


Hi Richard,

I'm trying to build an A-Z index page. Something like:
http://find.curtin.edu.au/indexaz/index.cfm.

The query string will be on each link from A to Z. Ie. <a
href="?index=A">A</a> <a href="?index=B">B</a> and so on. The page will then
load the following navigation

<reddot:cms>
    <if>
        <query valuea="Context:CurrentIndex.Headline.Substring(Int:0,
Int:1).ToUpper()" operator="==" valueb="QueryString("index") here">
            <htmltext>
                <li><a href="<%!! Context:CurrentIndex.GetUrl() !!%>"><%!!
Context:CurrentIndex.Headline !!%></a></li>
                <navigation:nextlevel>
            </htmltext>
        </query>
    </if>
</reddot:cms>

The <li> will then be sorted using a javascript.

Doesn't sound like a good plan, does it... Any good advice on how I should
implement this?

Andry


-----Original Message-----
From: reddot-c...@googlegroups.com
[mailto:reddot-c...@googlegroups.com] On Behalf Of Richard Hauer
Sent: Monday, 14 November 2011 7:38 PM
To: reddot-c...@googlegroups.com
Subject: RE: RedDot <if> statement and querystring

You might have more luck replacing
  Response.QueryString("A")
with
  System.Web.HttpContext.Current.Request.QueryString("A")


I'm still not sure it will work because the render tags are being executed
in a Windows Service and don't have access to the HttpContext object.
Or that's my guess anyways - worth a try.

Conceptually though you're not really doing the right thing anyway - what
querystring are you trying to read? Runtime? SmartEdit? SmartTree? Preview?
PreExecute? RDExecute? They're all different.
I suspect you're trying to do something you simply can't do and you'd be
better off putting your question to the group by starting with what you're
actually trying to do.

Regards,
Richard Hauer


-----Original Message-----
--
You received this message because you are subscribed to the Google Groups
"RedDot CMS Users" group.
To post to this group, send email to reddot-c...@googlegroups.com.
To unsubscribe from this group, send email to
reddot-cms-use...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/reddot-cms-users?hl=en.

--
You received this message because you are subscribed to the Google Groups
"RedDot CMS Users" group.
To post to this group, send email to reddot-c...@googlegroups.com.
To unsubscribe from this group, send email to
reddot-cms-use...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/reddot-cms-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "RedDot CMS Users" group.

Andry Poernomo

unread,
Nov 14, 2011, 8:24:45 AM11/14/11
to reddot-c...@googlegroups.com

Hi Richard,

 

Oh right... hmmm... how and I supposed to implement this function...

 

Andry

RedDotExpert

unread,
Nov 14, 2011, 10:41:47 AM11/14/11
to RedDot CMS Users
Hi Andry,

I am teaching a CMS class at a discounted price, please let me know if
you are interested.

In the mean time, please help yourself with some free course materials
from www.google.com and http://www.reddotcmsblog.com/.

Stu Wilson

unread,
Nov 17, 2011, 6:58:40 AM11/17/11
to RedDot CMS Users
Andry

You will need to do this in code. We have implemented a few of these
and they bascially all follows the same pattern. Note, this code is
not Unicode capable. Also note I beleive this is leagacy ASP code
written in JScript.

Loop thru your navigation:
<%
// variable to hold the entries we need to display
var arrLetters = new Array();
<!IoRangeList>
// get the letter for the page and add to letters list
var intLetter = "<%hdl_PageName
%>".substring(0,1).toUpperCase().charCodeAt(0) - 65;
// create the array if necessary
if (arrLetters[intLetter] == undefined) arrLetters[intLetter] =
new Array();
// add the entry to the list
arrLetters[intLetter].push("<%hdl_PageName%>|<%lst_Navigation%>");
<!/IoRangeList>
%>

that builds up an array of letters, and each array (per letter) is
either undefined (no items with that letter) or antoher array of items
beginning with that letter

<%
/************************************************
* LOOP FOR ALL THE ENTRIES TO SHOW THE BUTTONS *
************************************************/
for (var intLoopLetter = 65; intLoopLetter < 91; intLoopLetter ++)
{
// get the letter that we're dealing with
var strLetter = String.fromCharCode(intLoopLetter);
%>
<li id="iABC-<%=strLetter%>" class="ABC-<%=strLetter
%>">
<%
// do we have that letter in the list to show
if (arrLetters[intLoopLetter - 65] == undefined)
{
%>
<span><%=strLetter%></span>
<%
}
else
{
%>
<a href="#iABC-<%=strLetter%>-List" title=""><
%=strLetter%></a>
<%
}
%>
</li>
<%
}
%>

then once you have the list of available Letters, you show the
content. Each letter gets its own div, and items within that div
correspond to the page

<!IoRangeNoRedDotMode>
<%
/*****************************************
* LOOP FOR ALL THE ENTRIES TO SHOW THEM *
*****************************************/
// get the letter that we're dealing with
var strLetter = "";
var strActualLetter = "";
var strMyLetter = "";
%>
<!/IoRangeNoRedDotMode>



<!IoRangeList>

<%
// get the letter we're dealing with
strActualLetter = "<%hdl_PageName%>".toUpperCase().substring(0,1);
// are we a different letter
if (strActualLetter != strLetter)
{
if (strLetter != "")
{
%>
</ul>
</div>
<%
}
// save the letter for later
strLetter = strActualLetter
%>
<div class="list" id="iABC-<%=strLetter%>-List">
<h3><%=strLetter%></h3>
<ul>
<%
}
%>

<li>
<a href="<%lst_Navigation%>"><%hdl_PageName%></a>
</li>
<!/IoRangeList>


<!IoRangeNoRedDotMode>
<%
// always need to show the closing bit
%>
</div>
<!/IoRangeNoRedDotMode>

</div>
<%
}
%>



Obviosuly I've left some HTML out, but it should get you started.

Also note that if your list is not sorted alphanumerically, then you
will have to sort the entries in each sub-array.

Stu

On Nov 14, 1:24 pm, "Andry Poernomo" <andry.poern...@gmail.com> wrote:
> Hi Richard,
>
> Oh right... hmmm... how and I supposed to implement this function...
>
> Andry
>
> From: reddot-c...@googlegroups.com
> [mailto:reddot-c...@googlegroups.com] On Behalf Of Richard Hauer
> Sent: Monday, 14 November 2011 9:19 PM
> To: reddot-c...@googlegroups.com
> Subject: RE: RedDot <if> statement and querystring
>
> That's totally not going to work. The rendertag is evaluated prior to
> publication and can'tinteract with a client session.
>
> Regards,
> Richard.
>
> Sent from my mobile. Sorry if it's brief.
>
> For more options, visit this group athttp://groups.google.com/group/reddot-cms-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "RedDot CMS Users" group.
> To post to this group, send email to reddot-c...@googlegroups.com.
> To unsubscribe from this group, send email to
> reddot-cms-use...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/reddot-cms-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "RedDot CMS Users" group.
> To post to this group, send email to reddot-c...@googlegroups.com.
> To unsubscribe from this group, send email to
> reddot-cms-use...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/reddot-cms-users?hl=en.

Jian Huang

unread,
Nov 18, 2011, 3:10:06 PM11/18/11
to RedDot CMS Users
For those who want to avoid preexecution, here is the simpler
JavaScript version

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.7.0/jquery.min.js"></script>
<script type="text/javascript">
var GlossaryLetters =
["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];

$(document).ready(function() {
$.each(GlossaryLetters, function(index, value) {
var SelectorQuery = "a[title^=" + value + "]:first, a[title^=" +
value.toLowerCase() + "]:first";

$(SelectorQuery).first().prepend("<a name=\"" + value + "\" />");
$("#glossary").append("<a href=\"#" + value + "\">[" + value + "]</
a>");
});
});
</script>

<div id="glossary"></div><br />
<!IoRangeList>
<a href="<%lst_Navigation%>" title="<%hdl_PageName%>"><%hdl_PageName
%></a><br />
<!/IoRangeList>

Andry Poernomo

unread,
Nov 26, 2011, 9:50:26 PM11/26/11
to reddot-c...@googlegroups.com
Hi Stu,

Thanks so much for your code... The problem is, the server is running cold
fusion... But hey... I'll give a go and see if asp will work...

Cheers mate!

Stu Wilson

unread,
Nov 27, 2011, 4:25:15 PM11/27/11
to RedDot CMS Users
Andry

The output from the script is pure HTML, since the code snippet I
provided needs to be preexecuted by the OpenText (RedDot) CMS within
the template... which obviously needs Classic ASP and/or Asp.Net to
run dependant on CMS version. You can probably use ColdFusion code to
do the work, since you can tell the CMS to run any code language
within the templates, but generally the CMS box already runs Asp so we
use both Asp and Asp .Net.

Jian's jQuery solution does work, however you don't get the A-Z
functionality without JS enabled. Generally, I think that's a bad
thing for universal readability and certain types of websites have to
meet certain levels of functional compliance without JS enabled.

Stu

Reply all
Reply to author
Forward
0 new messages