Custom URL built from value in column

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
TheNoLifer
Veteran Member
Posts: 67
Joined: 2015-06-06 12:10

Custom URL built from value in column

Post by TheNoLifer » 2015-06-09 16:10

Hi all!

Wondering if/how it would be possible to build a clickable-link from data entered into a column. For example - a website lists its content by ID, and their links are in the format http://www.website.com/ID (ID being a 6 digit number).

I have a column in my table for "Website ID" where users can enter the 6 digit number, and it obviously displays as plain text.

Is there any way I could pre-build the URL and append the ID behind the scenes, turning the 6 digit number into a hyperlink which would take users to http://www.website.com/123456? (or whatever they'd put into the "Website ID" field).

Any thoughts would be much appreciated!

Cheers,

TNL.

User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Re: Custom URL built from value in column

Post by shasta59 » 2015-06-11 01:18

First off - what version of AppGini are you using.

Is the link to take them to another record in your database app or could it take them to some totally unrelated website?

Alan
Calgary, Alberta, Canada - Using Appgini 5.50 -

TheNoLifer
Veteran Member
Posts: 67
Joined: 2015-06-06 12:10

Re: Custom URL built from value in column

Post by TheNoLifer » 2015-06-11 01:40

Hi Alan,

I'm on 5.40.

The link is to an unrelated website, always in the format of http://www.url.com/site/123456 - the 123456 coming from a column in my db.

I stumbled upon this post - http://forums.appgini.com/phpbb/viewtop ... f=4&t=1524 - which, if I'm reading it correctly, is doing much the same as I intend to. Hardcode the first part of the URL in the detail view, retrieve the relevant column value and append it.

Although I'm not clear on which .php file builds the detail view (going out on a limb here, perhaps the _view.php file?) or how it would select and display the corresponding record for the row currently being viewed.

I may have misinterpreted patsd102's post, and if so, please let me know so I'm not barking up the wrong tree!

Cheers,

Ally

patsd102
Veteran Member
Posts: 142
Joined: 2013-01-15 19:59

Re: Custom URL built from value in column

Post by patsd102 » 2015-06-11 19:44

HI friend,

This is my line of code on the template TV.html page (activations)

<td id="Activations-date-<%%VALUE(id)%%>" class="Activations-date "><%%SELECT%%><%%VALUE(date)%%><%%ENDSELECT%%></td>
<td id="Activations-act-<%%VALUE(id)%%>" class="Activations-act "><a href="http://www.qrz11.com/show_prof.php?call ... VALUE(act)%%>" target="_blank"><%%VALUE(act)%%></td>
<td id="Activations-log-<%%VALUE(id)%%>" class="Activations-log "><a href="http://www.qrz11.com/show_prof.php?call ... VALUE(log)%%>" target="_blank"><%%VALUE(log)%%></td>

First line is %select% opens to detail page
Second opens to a second site called QRZ11.com (act field) input
Third is same (log field)

Target - blank is to open to a new tab

This is the line you need to replace for your own site. (http://www.qrz11.com/show_prof.php?callsign=)
And change the field name to your site as well,

I hope this helps,

My page = http://activations.dx27.net/Activations_view.php

Pat
23.17

TheNoLifer
Veteran Member
Posts: 67
Joined: 2015-06-06 12:10

Re: Custom URL built from value in column

Post by TheNoLifer » 2015-06-11 20:28

Fantastic! Got it working in 2 minutes in the table view, with your example!

When a guest user logs into the site and selects something from the table view, they see the Detail View, which also has this field in plain text - that's my next port-of-call for this, making that into a link also. I shall fiddle, now that I know what I'm looking for.

Many thanks again - and nice background by the way!

patsd102
Veteran Member
Posts: 142
Joined: 2013-01-15 19:59

Re: Custom URL built from value in column

Post by patsd102 » 2015-06-11 21:41

Glad I could be of help.
Thanks for your comment about my background.

To add your own background, go your your theme css page. (i use cosmo)
Find the .body line and replace with this.

body {
font-family: "Open Sans", Calibri, Candara, Arial, sans-serif;
font-size: 15px;
line-height: 1.428571429;
color: #333333;
background-image: url(http://yourlinktoimage.jpg);
background-size: 100% 100%;
background-attachment: fixed;
background-position: center;
}

Cheers

pat
23.17

TheNoLifer
Veteran Member
Posts: 67
Joined: 2015-06-06 12:10

Re: Custom URL built from value in column

Post by TheNoLifer » 2015-06-12 02:28

Thanks. Is that for a Global background image? I put different background images on my login, sign-up, forgot password, main, etc pages by adding the usual;

<style>
body
{
background-image: url blah blah blah
}
...

On each relevant page. Seems to work and not break anything!

patsd102
Veteran Member
Posts: 142
Joined: 2013-01-15 19:59

Re: Custom URL built from value in column

Post by patsd102 » 2015-06-12 16:34

Yes, Its css file,, so all pages,

Pat
23.17

Post Reply