Newbie to WebSpeed

Posted by Admin on 19-May-2010 03:38

We do use our Progress WebSpeed to allow subscribers to logon site, and read our PDF-newspaper!

To day we have a static link to a website showing the content. But we have many readers that know of the link to this website, and we only want subscribers to read.

The problem has been that we have to compile the webspeed html-page every time we change the link for a new newspaper, therefor we have a static link like this:

http://www.arvikanyheter.se/websidor/hela/senaste.pdf

But we want to give our subscribers a better service, so we want instead to include this into the html-page, but we dont want to make a new manual compile every morning.

The code we want to include is changing every day...

<table style="margin-left: 20px; width: 600px;">
<tr>
                <td colspan="6" style="height: 20px; vertical-align: top;"><b>Arvika Nyheter:</b></td>
            </tr>
            <tr>
                <td>
                    <div><a href="http://np.netpublicator.com/netpublication/n93635806" target="_blank" title="AN20100510">
                        <img src="http://api.netpublicator.com/documents/n93635806/thumbnails_xl/1" style="border:solid 1px #d8d8d8;" width="100px" alt="AN20100510" border="0" />
                    </a></div>
                    <div style="padding-top:5px;">10 maj</div>
                </td>
                <td>
                    <div><a href="http://np.netpublicator.com/netpublication/n88283516" target="_blank" title="AN20100507">
                        <img src="http://api.netpublicator.com/documents/n88283516/thumbnails_xl/1" style="border:solid 1px #d8d8d8;" width="100px" alt="AN20100507" border="0" />
                    </a></div>
                    <div style="padding-top:5px;">7 maj</div>
                </td>
                <td>
                    <div><a href="http://np.netpublicator.com/netpublication/n47282868" target="_blank" title="AN20100505">
                        <img src="http://api.netpublicator.com/documents/n47282868/thumbnails_xl/1" style="border:solid 1px #d8d8d8;" width="100px" alt="AN20100505" border="0" />
                    </a></div>
                    <div style="padding-top:5px;">5 maj</div>
                </td>
                <td>
                    <div><a href="http://np.netpublicator.com/netpublication/n34778280" target="_blank" title="AN20100503">
                        <img src="http://api.netpublicator.com/documents/n34778280/thumbnails_xl/1" style="border:solid 1px #d8d8d8;" width="100px" alt="AN20100503" border="0" />
                    </a></div>
                    <div style="padding-top:5px;">3 maj</div>
                </td>
                <td>
                    <div><a href="http://np.netpublicator.com/netpublication/n26483350" target="_blank" title="AN20100430">
                        <img src="http://api.netpublicator.com/documents/n26483350/thumbnails_xl/1" style="border:solid 1px #d8d8d8;" width="100px" alt="AN20100430" border="0" />
                    </a></div>
                    <div style="padding-top:5px;">30 april</div>
                </td>
                <td>
                    <div><a href="http://np.netpublicator.com/netpublication/n45055819" target="_blank" title="AN20100428">
                        <img src="http://api.netpublicator.com/documents/n45055819/thumbnails_xl/1" style="border:solid 1px #d8d8d8;" width="100px" alt="AN20100428" border="0" />
                    </a></div>
                    <div style="padding-top:5px;">28 april</div>
                </td>
            </tr>

Is there a way in WebSpeed to make includes?

We do not want to place this "information" on public server, then we could have done a INFRAME, but we want to secure the info so only users that have payed the subrscription can reach the links.

I would be happy to get som more info or feedback for a solution inside WebSpeed, that we can use.

All Replies

Posted by Matt Baker on 19-May-2010 09:10

Include files won't help here because they are compiled directly into the .r for the web object.

Add some code that calls a .p that returns the new value.  The value could be stored in some external file or database as necessary.

something like:

define variable newnewspdf as character no-undo.

run getcurrentnewsfile.p (output newnewspdf).

if newnewspdf <> ? then do:

  {&OUT} "the news".

end.

Posted by Admin on 19-May-2010 09:13

Do you have the "file names" (i e n93635806" for May 10) stored in your database or elsewhere or can they somehow be calculated?

Then you should be able to solve it rather easy.

Otherwise you can always do like this:

1) Store the PDF-paper in a folder not reachable from the web.

2) Create a small webspeed application that

A) Check user name and password

B) In case it's correct retrieves the pdf-file to the browser.

You will have to do something like this:

DEFINE VARIABLE vdata AS RAW NO-UNDO.

DEFINE VARIABLE cFile AS CHARACTER NO-UNDO.

/* Just an example location of course */

cFile = "g:\newspaper_pdf\helatidningen.pdf".

/* Make shure you dont send the default text/html content type first*/

output-content-type("application/pdf").

INPUT STREAM infile FROM VALUE(cPDF) BINARY.

LENGTH(vdata) = 20480.
REPEAT:

  IMPORT STREAM infile UNFORMATTED vdata.
  PUT {&WEBSTREAM} CONTROL vdata.
END.
LENGTH(vdata) = 0.
INPUT STREAM infile CLOSE.
     

Best regards

Jens

This thread is closed