Click to See Complete Forum and Search --> : URL Conditional HELP!


Porters_Kid
12-12-2006, 01:35 PM
I am completely new to asp and need a bit of help. I have a ton of dynamic pages that I need an asp conditional to run on. I know the urls of all the pages and I want to know if there is an easy way to write a conditional statement that if they are on a specific page that it outputs something depending on the url they are on. Is there an easy way to do this?

nbcrockett
12-12-2006, 02:59 PM
I would just write your conditional statement within each page. If you'll post more detail about what your trying to do I might be able to help you more. Include code if you have it.

Porters_Kid
12-12-2006, 03:03 PM
Sorry about that, this is what I have thus far but it does not seem to be working.


Code:
<% Dim myVar
myVar = Request.Item("dept")

If myVar = "H21" then
Response.Write( "Snowboards" )
End if %>

nbcrockett
12-12-2006, 03:32 PM
What is Request.Item("Dept")? I'm not familiar with it.

Porters_Kid
12-12-2006, 03:35 PM
sorry, see url here (http://www.porterstahoe.com/istar.asp?a=500&dept=H21)

nbcrockett
12-12-2006, 03:47 PM
Ok, I see what Dept is, but what is Item. I've never heard of that. More important is where is that value coming from.

Porters_Kid
12-12-2006, 03:51 PM
really all I want that to do is when the user goes to a certain url then a message is displayed at the bottom of the page.

nbcrockett
12-12-2006, 04:03 PM
It sounds like all you need to do is plug this into each page that you want a message to display.

Response.Write "This Page's Message Here"

It doesn't sound like it needs to be conditional. If everytime time a person goes to index.asp they see the same message then you just need to put the above code into that page. If I'm misunderstanding what you're trying to accomplish I'm sorry. Post more details and I'll continue to try and help.

Porters_Kid
12-12-2006, 04:07 PM
that would work but that's single template that pulsl a couple thousand different items into it. Some can be snowboards and other pages can be boots, thats why I need a conditional statement so if they are on a page with just boards it says snowboards and if its a page with boots it says boots.

nbcrockett
12-12-2006, 04:16 PM
Ok, I didn't look close enough at your website. This should work.

<%
Dim myVar
Dim myMessage

myVar = Request.QueryString("dept")

Select Case myVar
Case "H21"
myMessage = "Snowboards"
Case "H22"
myMessage = "Boots"
Case "H23"
myMessage = "Bindings"
Case Else
myMessage = ""
End Select

Response.Write myMessage
%>

Porters_Kid
12-12-2006, 04:22 PM
That didn't seem to work, but thatnk you thus far for your help....

I uploaded the page and this is the url again to see what is looks like.

page (http://www.porterstahoe.com/istar.asp?a=500&dept=H21)

I wonder if it could be the page type... currently its saved as a .template file and I have tried to use includes but I get the same result as I would if I put the code on the main page.

nbcrockett
12-12-2006, 04:26 PM
Change the extension to .asp

Porters_Kid
12-12-2006, 04:31 PM
unfortunately I can't the system we have inplace needs the .template extension... i could always use an iframe solution i guess.... but thats not the best way to figure this one out...

nbcrockett
12-12-2006, 04:33 PM
What happens if you put the code on the main page?

Porters_Kid
12-12-2006, 04:36 PM
it prints all the code out.. doesn't seem like it even runs the code.

Porters_Kid
12-12-2006, 04:50 PM
i even tried to make it an include but it still prints out all the code...

nbcrockett
12-12-2006, 04:59 PM
You mean it displays it on screen like text?

Porters_Kid
12-12-2006, 05:02 PM
yes, all the code.

Porters_Kid
12-12-2006, 05:06 PM
let me clarify... sorry, in firefox it prints the code out on the page, in IE it does nothing.

Porters_Kid
12-12-2006, 05:08 PM
i looked in the source code in IE and i can see the code but thats it.

nbcrockett
12-12-2006, 06:36 PM
Are you using ASP code else where on this page or does it just have the ASP extension? Reason I ask is that ASP code shouldn't show up in the code like that. Even if the code was incorrect it wouldn't show up like that. Which makes me wonder if you have ASP installed/enabled on your server.

Porters_Kid
12-12-2006, 07:03 PM
the company that set our ecommerce site up uses wierd code... they use templates and includes and I will attach a snippet of thier code so you can get a better idea of the hill I am climbing.

<isdata source="IStarDataSources.CategoryLister" deptMfgOutput="3"
forceDept="1" forceSubClass="8">

<isloop name="$departments">

<ul class="brands">
<li class="brandHeader">Brands:</li>
<isloop name="$manufacturers">
<li class="brandListing">
<a href="<isvar name="$mfgBrowseURL">"><isvar name="$mfgName"></a>
</li>
</isloop>
</ul>

</div>
</isloop>

they use all of their own code but it all works in asp.

nbcrockett
12-12-2006, 08:01 PM
Some of that code is HTML and some I don't recognize. None of it however is ASP code. Do you have access to the webserver? If so are you running Windows IIS? If not you should ask your web admin if ASP is enabled on your site.

russell
12-12-2006, 09:36 PM
Porters_Kid, the template is meant to be loaded and parsed by something else. Would need to see the code that parses it to tell u what is going on. could be asp, a dll, php, xslt...lots of things.

btw nbcrockett Request.Item("something") is a valid way to access the Request collection, thus by not specifying "form" or "querystring" one can access the value irrespective of whether it came from a GET or a POST. Bad practice though, and the way u showed -- Request.QueryString("something") -- is the right way to do it.

nbcrockett
12-13-2006, 09:29 AM
Russell, thanks for the clarification. I had never seen the Item property.

Porters_Kid
12-13-2006, 11:24 AM
this is what I could find out

Server Software Microsoft-IIS/5.0
Operating System Windows_NT
Script Engine VBScript (version: 5.6.7426)

Porters_Kid
12-13-2006, 11:30 AM
the template page has an include, and the includes code looks like....


<isinclude name="/stock/browse/classnav.include">

<isif expr="collcount($products) == 0">
<isinclude name="productlisting\\nonefound.include">
<iselse>
<isif expr="$sortstyle == 1">
<isinclude name="productlisting\\sortcell-basic.include">
<iselseif expr="$sortstyle == 2">
<isinclude name="productlisting\\sortcell-extended.include">
</isif>

<isinclude name="productlisting\\pagination-top.include">

<isif expr="$browselistingtype == 3">
<isinclude name="productlisting\\products-extended.include">
<iselseif expr="$browselistingtype == 2">
<isinclude name="productlisting\\products-iconic.include">
<iselseif expr="$browselistingtype == 1">
<isinclude name="productlisting\\products-basic.include">
<iselseif expr="$browselistingtype == 0">
<isinclude name="productlisting\\products-basictn.include">
</isif>

<isinclude name="productlisting\\pagination-bottom.include">
</isif>

Porters_Kid
12-13-2006, 11:32 AM
then if the sortcell-basic.include is true then the sortcell include looks like this...

<table class='istar browse-basic'>
<!-- browse basic header -->
<tr>
<th class='istar tableheader header descriptioncell'>
<isif expr="strcmp($selectedsorttype, 'ALPHADESC') == 0">
<a href='<isvar name="$sortalphaurl">'>Description</a>
<iselse>
<a href='<isvar name="$sortalphadescurl">'>Description</a>
</isif>
</th>

<isif name="$showmanufacturer">
<th class='istar tableheader header manufacturercell'>
Brand
</th>
</isif>

<isif name="$show_stockstatus">
<th class='istar tableheader header instockcell'>
<a class='istar tableheader' href='<isvar name="$sortinstockurl">'><isvar name="$stockstatus_label"></a>
</th>
</isif>

<isif expr="$suppress_price != 1 | $suppress_addtocart != 1">
<th class='istar tableheader header pricecell'>
<isif expr="$suppress_price == 0">
<isif expr="strcmp($selectedsorttype, 'PRICE') == 0">
<a class='istar tableheader' href='<isvar name="$sortpricedescurl">'><isvar name="$price_label"></a>
<iselse>
<a class='istar tableheader' href='<isvar name="$sortpriceurl">'><isvar name="$price_label"></a>
</isif>
<iselse>
&nbsp;
</isif>
</th>
</isif>
</tr>

<isloop name="$products">

<isif name="_odd_">
<isexpr expr="$rowclass='istar tablerow1'">
<iselse>
<isexpr expr="$rowclass='istar tablerow2'">
</isif>

<tr>
<td class='<isvar name="$rowclass"> content descriptioncell'>
<a href='<isvar name="$detailurl">'><isvar name="$shortdescription"></a>
</td>

<isif name="$showmanufacturer">
<td class='<isvar name="$rowclass"> content manufacturercell'>
<isvar name="$manufname">
</td>
</isif>

<isif name="$show_stockstatus">
<td class='<isvar name="$rowclass"> content instockcell'>
<isif expr="strcmp($stockstatus,'I') == 0">
<img src="/images/instock_check.gif" ALT="<isvar name="$instock_label">">
<iselse>
<img src="/images/outstock_check.gif" ALT="<isvar name="$outstock_label">">
</isif>
</td>
</isif>

<isif expr="$suppress_price != 1 | $suppress_addtocart != 1">
<td class='<isvar name="$rowclass"> content pricecell'>
<isif expr="$suppress_price == 0">
<isif expr="$compareprice_low > 0 & $show_compareat == 1">
<!-- display compare price -->
<div class='compareprice'>
<isvar name="$compareat_label">:
<isif expr="$compareprice_low == $compareprice_high">
<span class='dollars'><isvar expr="formatprice($compareprice_low)"></span>
<iselse>
<span class='dollars pricerange'><isvar expr="formatprice($compareprice_low)"> - <isvar expr="formatprice($compareprice_high)"></span>
</isif>
</div>
</isif>

<isif name="$onsale">
<div class='sale-regularprice'>
<isif name="$sale_regprice_label">
<isvar name="$sale_regprice_label">:
</isif>
<isif expr="$sale_compareprice_low == $sale_compareprice_high">
<span class='dollars'><isvar expr="formatprice($sale_compareprice_low)"></span>
<iselse>
<span class='dollars pricerange'"><isvar expr="formatprice($sale_compareprice_low)"> - <isvar expr="formatprice($sale_compareprice_high)"></span>
</isif>
</div>
<div class='saleprice'>
<isif name="$saleprice_label">
<isvar name="$saleprice_label">:
</isif>
<isif expr="$price_low == $price_high">
<span class='dollars'><isvar expr="formatprice($price_low)"></span>
<iselse>
<span class='dollars'><isvar expr="formatprice($price_low)"> - <isvar expr="formatprice($price_high)"></span>
</isif>
</div>
<iselse>
<div class='regularprice'>
<isif expr="$price_low == $price_high">
<span class='dollars'><isvar expr="formatprice($price_low)"></span>
<iselse>
<span class='dollars pricerange'><isvar expr="formatprice($price_low)"> - <isvar expr="formatprice($price_high)"></span>
</isif>
</div>
</isif>
</isif>

<isif expr="$suppress_addtocart == 0">
<isif name="$instoreonly">
<img class='instoreonly' src="/images/in_store_add_cart.gif" ALT="Purchase In Store Only">
<iselse>
<a class='addtocart' href='<isvar name="$addtocarturl">'><img class='addtocart' src="/images/add_to_cart.gif" border=0 ALT="Add to Cart"></a>
</isif>
</isif>
</td>
</isif>
</tr>
</isloop>

</table>


does that help at all?

nbcrockett
12-13-2006, 11:51 AM
In IIS if you go to the properties of your website or virtual directory then go to the Home Directory tab is Execute Permissions set to None?

Porters_Kid
12-13-2006, 11:56 AM
I can't do that... our host has complete control over that and getting them to modify anything is really difficult.

nbcrockett
12-13-2006, 12:06 PM
If you can't enable IIS to use ASP then that code won't work. You'll have to use client side Java or something else. Sorry, but I think I've helped as much as I'm capable of. I'll keep checking the post incase there's something I can add. Good Luck!

russell
12-13-2006, 12:18 PM
what is the file extension on the pages of your site? is it by chance .cfm ?

Porters_Kid
12-13-2006, 12:20 PM
either .template or .include but thats it

Porters_Kid
12-13-2006, 12:22 PM
all of the dynamic urls have /istar.asp? and then /istar.asp?a=6 (the number changes depending on the template) /istar.asp?a=3 or /istar.asp?a=22

russell
12-13-2006, 12:24 PM
thats the extension when u load a page in your browser? do ANY pages work? can u post a link to one that does?

russell
12-13-2006, 12:26 PM
ok, cool. somewhere you have an asp file(s) loading and parsing these templates. THAT is the code we need to see to fix your problem.

russell
12-13-2006, 12:27 PM
also, look in the web root for a file called Global.asa. might need to see code in there too.

Porters_Kid
12-13-2006, 12:31 PM
http://www.porterstahoe.com/istar.asp?a=6&id=B700410X!BUR&csurl=%2Fistar%2Easp%3Fa%3D500%26dept%3DH21%26

Porters_Kid
12-13-2006, 12:36 PM
no global.asa a localstart.asp file and a aspnet_client folder with all .js files
SmartNav.js
SmartNavIE5.js
WebUIValidation.js

russell
12-13-2006, 12:47 PM
need to see istar.asp. that is where to put your conditional code as u originally asked.

Porters_Kid
12-13-2006, 12:50 PM
i put the conditional on the page http://www.porterstahoe.com/istar.asp?a=500&dept=H21

its a .template page

Porters_Kid
12-13-2006, 12:51 PM
in firefox you can see the code printed out on the bottom of the page

russell
12-13-2006, 12:53 PM
there is a file called istar.asp. that is where u want to put it. not on the .template file

Porters_Kid
12-13-2006, 12:57 PM
i need to contact our hosting company to find out where that file is...

Porters_Kid
12-13-2006, 01:09 PM
<%
set obj = server.createobject("istar21.istarmanager")
'obj.templatepath = "c:\inetpub\templates\"
obj.processrequest request,response,application,server,session
%>

thats all thats in the istar.asp file

Porters_Kid
12-13-2006, 01:12 PM
even better, the response from our host.

We support ASP on everything except dynamic pages. You can't do ASP in an i.STAR template. In fact, other than the i.STAR scripting commands

themselves, we don't allow any server-side scripting on dynamic pages. Client-side scripting on dynamic pages is fine (e.g. Javascript).

In short, if you want to use ASP, it has to be a standalone page that doesn't run through the i.STAR template processor.

Porters_Kid
12-13-2006, 01:48 PM
so now what do I do? the pages that I need to run the conditional on are the template pages... and here is our hosts reply

We support ASP on everything except dynamic pages. You can't do ASP in an i.STAR template. In fact, other than the i.STAR scripting commands

themselves, we don't allow any server-side scripting on dynamic pages. Client-side scripting on dynamic pages is fine (e.g. Javascript).

In short, if you want to use ASP, it has to be a standalone page that doesn't run through the i.STAR template processor.

russell
12-13-2006, 01:55 PM
do they provide documentation on istar21.dll? what is the host?

Porters_Kid
12-13-2006, 01:59 PM
http://www.camcommerce.com/ is the host and www.istarhelp.com for the docs but its really tough to find any info that could help on their site.

Porters_Kid
12-13-2006, 02:03 PM
sorry but no docs on the dll file

russell
12-13-2006, 04:07 PM
you need to have a look at these two documents

http://www.istarhelp.com/acrobat/Modifyingistarpages.pdf
http://www.istarhelp.com/acrobat/Opening%20v41.pdf

Unfortunately, your choices are to learn to script their templates or move to a different commerce tool.

You could try modifying istar.asp to add your own dynamic content, but they explicitly say not to do it, so the risk is 100% your own if you do. If you do try it, make a copy of the file (renaming it to something different ) and try there. It is likely that any custom modification will need to be at the end of the file (if the dll is sending any http headers it will break if you have already put content in the buffers).

Porters_Kid
12-13-2006, 10:33 PM
I did some digging and finally found the asp file the parses the templates. the code from that page follows.

<%
set obj = server.createobject("istar21.istarmanager")
'obj.templatepath = "c:\inetpub\templates\"
obj.processrequest request,response,application,server,session
%>

any suggestions?

seanbennington
12-18-2006, 01:25 PM
tried to help, but realized there were more pages of dialog. Ignore my previous post.

SEan

Porters_Kid
12-18-2006, 01:37 PM
found that this is an easy work around to the problem... the more I spoke with our host the complicated things got. No asp can be in the template folder, also there is only one file that parses all the templates and rather than re writing and possibly screwing things up we just tried something else that seemed to work.

<%
url = "http://www.porterstahoe.com/istar.asp?a=500&dept=H23&manufacturer=BUR"
set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send ""
Response.write xmlhttp.responseText
set xmlhttp = nothing
%>