Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 401203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:00:45+00:00 2026-05-12T17:00:45+00:00

i used rows.xml() to generate html output. i want to know how to add

  • 0

i used rows.xml() to generate html output. i want to know how to add html codes to this generated html page e.g: “add logo, link css file,.. etc”

rows=db(db.member.membership_id==request.args[0]).select(db.member.membership_id
,db.member.first_name,db.member.middle_name
,db.member.last_name)
return rows.xml()

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:00:45+00:00Added an answer on May 12, 2026 at 5:00 pm

    There are many HTML helpers you can use, for example:

    html_code = A('<click>', rows.xml(), _href='http://mylink')
    html_code = B('Results:', rows.xml(), _class='results', _id=1)
    html_page = HTML(BODY(B('Results:', rows.xml(), _class='results', _id=1)))
    

    and so on.

    You can even create a whole table automatically:

    table = SQLTABLE(rows, orderby=True, _width="100%")
    

    and then pick it apart to insert links or modify its elements.

    It is very powerful and normally you don’t have to bother writing the actual HTML yourself. Here is the cheatsheet, or you can check directly on the website documentation.


    Edit: Just to make sure, you don’t actually need to generate the whole HTML page, it is easier to let web2py insert your response in a template that has the same name as your controller (or force a particular template with response.view = 'template.html'. The documentation tutorial will explain that better and in further details.

    In a few words, if you are implementing the function index, you could either return a string (the whole page HTML, which seems to be what you are heading for), or a dictionary to use templates.

    In the first case, just code your function like this:

    def index():
        # ... code to extract the rows
        return HTML(BODY(B('Results:', rows.xml(), _class='results', _id=1))).xml()
    

    Otherwise, write an html template in views/controller/index.html (or another file if you insert the response.view=... in your function, to re-use the same template), which could be like this:

    <html><head></head>
      <body>
        {{=message}}
      </body>
    </html>
    

    and return a dictionary:

    def index():
        # ... code to extract the rows
        html = B('Results:', rows.xml(), _class='results', _id=1)
        return dict(message=html)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this xml where i'd like to add a new row <rows> <row>
I want to modify an existing XML-File. I used a DataSet to load the
I know there are few questions regarding this issue of 'getView called few times'
I have an xml that contains two groups of related values: <Rows> <!-- first
Can Android's addHeaderView() be used to add multiple headers throughout a single ListView? Can
I want to generate line graph based on database. First time i am using
I'm trying to output data into an xml file, everything is working fine except
I have an xml with one textveiw and one edittext in it .I used
LOAD XML LOCAL INFILE 'file1.xml' INTO TABLE my_table ROWS IDENTIFIED BY '<product>' Is it
Currently its working but I want the xml to contain the total number of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.