Good day,

I have problem that i'm just not 100% to go about it or if it will even work they way in which i wish it to.

My current site (article content based) has the option of the user being able to select the article he/she likes and have it e-mailed to them in html form. This is all fine and dandy for 1article at a time, but now i'm getting request for a "Shopping cart style" system in where the user can select multiple articles and have them e-mailed all at once. This is where I am a little baffled.

So here is my quetsion, using nothing more than a little java, xsl, .xml (site does not use any access,sql ect) can I somehow acomplish this. Lets keep in mind currently the site is handled like so.

- All articles for current month are stored in a master.xml file, each articile id inside that file are seperate .xml files.

- User starts by seeing a synopsys of the articles, title, headline, image if there is one, and brief you need to read more if this interests you hook paragraph. (all styled by .xsl from reading the master.xm)

- User then has the option of reading the full article or simply just e-mailing the article to themselves. (Call e-mail script or view article script/xsl depending on choice).

Any guidence would be much apreciated.

Thank you for your ideas in advance,

gt.

There are two ways you can handle this effectively.

You can use a Session variable for the articles, or you can use a cookie.

Obviously cookies will hold values through visits, so it might be best.

However, you can create a function and call it when needed to. This function can append the ID of the article to the session. Then when a user wants to receive the articles, you can split the session variable and do a search for each article and append that article to the email. I am not sure exactly how you are doing emails this way (5 articles could mean one hell of a lengthy email). If you are using attachments, attach each article, then send all articles at once.

I would stick with session variables and just add onto the session (keep it a string). Something like this:

If Len(Session("articles")) > 1 and Not Session("articles") = Nothing Then
Session("articles") = Session("articles") & ";" & ArticleID
Else
Session("articles") = ArticleID
End If

Then splitting it, you might have to check to see if the first character in the string is a ";"

Dim arr()
Dim articles
articles = Session("articles")

If Len(articles) > 1 And articles.substring(0,1) = ";" Then
articles.remove(0,1) 'if they allow remove in asp, not sure anymore.
'otherwise: articles = articles.substring(1, Len(articles))
End If

If Len(articles) > 0 And Not articles.substring(0,1) = ";" Then
arr = articles.split(";")
Else
articles.remove(0,1) 'if they allow remove in asp, not sure anymore.
'otherwise: articles = articles.substring(1, Len(articles))
End If

If Not arr Is Nothing Then
For Each item in arr
'search for the article, add to the email if you wish.
Next

'Send the email
End If

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.