Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 VP-ASP 7.0 Questions
 Custom Dynamic Pages
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

bengreen1980
Starting Member

27 Posts

Posted - August 04 2010 :  06:00:45  Show Profile  Reply with Quote
Hi Forum. New to VP-ASP, however very quickly grasping the setup and customisation. I have now configured the design and imported all the products. I would like to create a new page, file name: listartists.asp. I will write a custom script on this page to query the product data based on some custom fields - I can handle this fine. However, how can I easily make this new page pull in the overall site template using the VP-ASP shell?

devshb
Senior Member

United Kingdom
1904 Posts

Posted - August 04 2010 :  06:50:48  Show Profile  Visit devshb's Homepage  Reply with Quote
your listartists.asp page would look something like this......

<%option explicit%>
<%response.buffer=true%>
<!--#include file="shop$db.asp"-->
<%

ShopOpenDatabase dbc

' All your pre-output processing such as getting Request values
' into variables etc goes here

ShopPageHeader

' Your output of the main content of the page goes here

ShopPageTrailer

ShopCloseDatabase dbc

%>

If you're using vpaspv7 then you need to have that dbc (variable defined elsewhere globally already) connection open throughout, and only ever use that for your database connection, don't open another one. If you're below vpaspv7 then you'd only open/close it when you need it (and you'd need to declare it within your file as it's not declared globally in v6.5 and below)

We've got some addons (byz093;product-showcase, and by116; enhance searching/paging) which would help display the actual products using any given criteria, but I suspect that's not what you're after; I'm assuming you're simply doing a group-by of artist and showing those as links to the corresponding standard search for that value.

If that's the case, then you'd just use the above sample as a rough base, and just have your group-by query outputting the artist link/text each time round.

Simon Barnaby
Developer
[email protected]
www.BigYellowZone.com
www.BigYellowKey.com
Follow us on Twitter: http://twitter.com/bigyellowzone
Web Design, Online Marketing and VPASP addons

Edited by - devshb on August 04 2010 06:58:05
Go to Top of Page

bengreen1980
Starting Member

27 Posts

Posted - August 04 2010 :  07:14:13  Show Profile  Reply with Quote
Great response Simon. That's exactly what I am doing, and no doubt your code will work perfectly.

I have been playing for a while now in the system, its a shame you CANT add ASP in the 'content' on page manager... I guess this is a limit of the system?

Edited by - bengreen1980 on August 04 2010 07:16:33
Go to Top of Page

devshb
Senior Member

United Kingdom
1904 Posts

Posted - August 04 2010 :  07:26:50  Show Profile  Visit devshb's Homepage  Reply with Quote
yep; you can't add raw vbscript into the templates or the content html data (because of the way it gets processed/parsed) but what you could do is create a template-field/function that fires-off a given set of vbscript and then put that template field into the content template.

We used that logic (and our byz093 addon) so that we could showcase a given set of products on the bottom of a given content page (you put the where clause into one of the content record's spare fields, add a byz093 "call showcase with this where clause" template field to the content template, and then when you browse the content page you get the list of products for the where clause you just queried inside your content page).

I've got a feeling (although I'm not 100% sure) that you can also add template-fields actually inside your content html data (ie inside the data, not just inside the template) and it still gets processed dynamically; it might be my imagination but I thought I'd tried calling a template field inside my content html data and it seemed to process within the right context. I think that's why, if you have javascript or other weird stuff inside your data (eg some things from frontpage have things like [gte...]) you get "field gte not in database" - it seems to actually process the template twice; first it processes your template and replaces your template fields with the corresponding text, but then it re-processes what it's returned and does the same thing again. I'm not sure if that's just an accidental quirk or if it was intentional, but it can come in very handy because you can put things like [ccode] into your extendeddesc values etc. It might be one of those "at your own risk, we don't support it" scenarios.

Simon Barnaby
Developer
[email protected]
www.BigYellowZone.com
www.BigYellowKey.com
Follow us on Twitter: http://twitter.com/bigyellowzone
Web Design, Online Marketing and VPASP addons

Edited by - devshb on August 04 2010 07:56:12
Go to Top of Page

bengreen1980
Starting Member

27 Posts

Posted - August 04 2010 :  08:00:38  Show Profile  Reply with Quote
OK sounds good. Excuse my ignorance, but which ASP file should I create the function in? And then do I call it using [funtioname] syntax in the content editor?

Edited by - bengreen1980 on August 04 2010 08:01:03
Go to Top of Page

devshb
Senior Member

United Kingdom
1904 Posts

Posted - August 04 2010 :  09:28:42  Show Profile  Visit devshb's Homepage  Reply with Quote
shopfileio.asp

look for:
sub DoSpecialFormating

it's within that function; before the "end select" line at the end you'd create the line for how it gets called, eg you'd add:

Case "MYFUNCTIONNAME1"
value=MyFunctionName1(value, parsearray,parseRS)

then within the same file, after the end sub line of that function, you'd create your function like:

function MyFunctionName1(arg_in_id,parsearray,parseRS)
Dim thtml
thtml="what I want to output"
MyFunctionName1=thtml
end function

then within your content record you'd put this inside the html (or you can put it inside the template file)

[MYFUNCTIONNAME1 contentid]

where you want to output the html.

You can do a similar thing without using arguments, but that non-argument function works in a different way, and probably wouldn't output things in the right context in this instance.

We use byz033 when we want to create template fields for our addons, but essentially that does the same kind of thing, it's just that it does it in split-out files so that we/our-customers don't need to change shopfileio.asp every time they want to add a new template field, so you don't need to use byz033 just to create a new template field, you can use the example above instead.

But, if you also wanted "Related/Connected Info" then it's worth looking at (eg if you wanted to show customers' mail-list flag on your merchant email, or you want to show supplier names on your product pages etc), or if you're going to create loads of new template fields, then it's also worth looking at:
http://www.bigyellowkey.com/mysoftware_product_details.asp?prdid=247&opu=n

Remember that in v7 there's also an adminfileio.asp file in the admin folder (ie the admin equivalent of shopfileio.asp; if you wanted the template field to be available in admin too (eg on merchant order prints) then you'd need to make the same kind of changes to the adminfileio.asp file too.

Simon Barnaby
Developer
[email protected]
www.BigYellowZone.com
www.BigYellowKey.com
Follow us on Twitter: http://twitter.com/bigyellowzone
Web Design, Online Marketing and VPASP addons

Edited by - devshb on August 04 2010 09:46:34
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00