SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SubClass output into a variable for post-processing?

    Hi guys,

    I am really a PHP developer but am currently working as a Classic ASP dev, so please be gentle...

    I am working with some legacy code (the main dev needs to edit the code to return valid, semantic HTML rather than tables and divs).

    I want to call his class.subclass and place all the response.write data that would normally be returned directly to the browser into a variable.

    I will then try to extract all the anchor tags from this variable (string) into an array and foreach all of that out into an unordered list.

    Is that possible? If so, how would I do it?

    Many thanks,


    atw

    PS. to call his sub class, I simply add
    Code:
    <% Articles.Show_News %>
    into my HTML

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,609
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    If his subclass is currently doing Response.Write then you'll need to get him to change it so that the data is concatenated into a local class variable instead. Then you can get it into your own variable like so:
    Code:
    sData = Articles.Show_News
    and can then manipulate it as you need.
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the reply siteguru.

    Sadly, this class is part of many websites (all with one backend), so I cannot change this.

    I have done this before in PHP, using ob_start (start output buffer) and collecting the contents of the new output buffer into a variable...

  4. #4
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,609
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You can use Response.Buffer = True to buffer the content. Can't remember how to access the buffered content though.
    Ian Anderson
    www.siteguru.co.uk


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •