• Charlie

    (@cdarling)


    It took some head-scratching, but I got the alink parameter to work. The documentation isn’t wrong; it’s fine for reference. But may I suggest that the following might work a little better for someone trying to use alink for the first time? (Please feel free to use this in the official ABASE documentation if you’d like!)

    alink – alink=” <column> ( , <url> ( , <append> ( , <target> ) ) )”

    The alink=”…” attribute lets you hyperlink each value in a given column to some other Web page.

    <column> – The name of a column. When the table is displayed, each value in that column will be surrounded by <a href>...</a> tags to create a hyperlink.

    <url>
    If you don’t supply a value for <append> (see below), then <url> is the value to use for the href= attribute of the <a href> tag.

    If you do supply a value for <append>, then <url> is the first part of the value to use for the href= attribute of the <a href> tag.

    <append> – The name of a column. If the <append> parameter is present, then the value stored in the column you name in the <append> parameter gets appended to the end of the value you supplied in <url> to form the href= attribute of the <a href> tag.

    Using the <append> parameter means that the href= attribute of the <a href> tag will (potentially) be different for each row, depending upon the value stored in the column you name in the <append> parameter. (This is normally what you’d want to do.)

    If you don’t use the <append> parameter, then the href= attribute of the <a href> tag will be identical for each row.

    <target> – The value to use for the target= attribute of the <a href> tag. For example, use _blank to make the link open in a new browser window.

    alink example: To list the 100 latest post titles from your WordPress database and hyperlink each title to the “Edit Post” page for that particular post (which requires a URL like https://mysite.com/wp-admin/post.php?post=9999&action=edit), you’d do this:

    [abase alink=”Title, wp-admin/post.php?post=, Link, _blank” columns=”Title” sql=”SELECT wp_posts.post_title AS ‘Title’, CONCAT(wp_posts.ID,’&action=edit’) AS ‘Link’ FROM wp_posts WHERE wp_posts.post_type = ‘post’ ORDER BY wp_posts.post_date DESC LIMIT 0, 100″]

    • This topic was modified 8 years ago by Charlie.
    • This topic was modified 8 years ago by Charlie.
  • The topic ‘How to Use the ALink Parameter of ABASE’ is closed to new replies.