• Resolved dizwell

    (@dizwell)


    Hello Peter. Sorry if this is a silly question.

    I have read the doco on Dynamic hyperlinks and I think I’ve done what it says, and accordingly on the page I’ve linked to, you can see that there’s a new column added to the table, at the end, labelled ‘About’. Click on that and it’s supposed to take you to a page about the composer in question (currently, the only page that exists is for Ignace Joseph Pleyel, played at 11:21am on 10 May 2021. All the other links take you to a 404 page).

    So: I’m happy with that functionality, whereby the ‘About’ link takes you to different pages, depending on the name of the Composer/Artist in the row. Works fine.

    But… what I had *hoped* would happen would be that the composer’s name in the ARTIST column of the table would **itself become a hyperlink**. IE, that a reader could click that composer’s name and be taken to the page about that composer, without there being a separate ‘About’ column to do the job.

    Is that sort of thing possible (I could obviously alter the data in the table to be a hyperlink at the point of entry, but it stops being dynamic at that point!) Is such a feature even possible? And if it is, and it exists, does it have another name than ‘Dynamic Hyperlinks’?!

    As I say, if the problem exists between this user’s ears and keyboard, please feel free to move on to more important problems!

    Best wishes as ever,
    Howard

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter dizwell

    (@dizwell)

    Edited to add: the reason I’d like the data itself to be hyperlinked is because for one row, I’d like a reader to be able to click the ‘Artist’ to get biographical information about the composer and the ‘Album’ to get per-composition information. As things stand, I’m going to need one ‘link column’ per ‘data column’, and that would be pretty messy, I think.

    Try this in the dynamic link column, define the entire hyperlink. I don’t know your field names but this is an example. In this example The column will display the value of $$branch_slug$$

    <a href='https://$$branch_page$$$$branch_id$$' />$$branch_slug$$</a>

    Thread Starter dizwell

    (@dizwell)

    Sorry Charles, I don’t understand your answer.

    ‘Try this in the dynamic link column’? You mean, in Data Explorer, click Manage, Settings, Dynamic Hyperlinks, and add a variant of your code to the HTML field there?

    Not sure what that would achieve: the dynamic hyperlink column already correctly links to the $$ARTIST$$ page (the field name is ARTIST).

    So I am assuming you’re referring to doing something to the actual data column… but I can’t work out what you’re referring to in that case.

    Any elaboration would be appreciated. Thanks for taking the time, anyway!

    Regards
    HJR

    Yes that’s where I mean to make the changes. The difference with the way I code it is that the full hyperlink structure <a.. ..>test is defined and WPDA makes no changes and ignores the the column title. refer to https://www.canada.ca/en/services/benefits.html

    In you case the text would be defined as $$ARTIST$$

    then display this hyperlink column instead of the ARTIST column. Try it and see what happens.

    Thread Starter dizwell

    (@dizwell)

    Ah, I see. Let me try it and see how I get on.

    [60 seconds later…]

    Thank you. That is quite a neat workaround! Does precisely the job I’d hoped for! Many, many thanks.

    I still can’t help thinking, however, that it would be good to have a feature that would ‘dynamically wrap an opening and closing http a-tag’ around existing data, without having to cludge it quite like this. That is, declare a column to be dynamically hyperlinkable and then provide a ‘template URL’ to wrap around the data, with the ‘$$’ data columns providing a dynamic component to the resulting URL.

    If I was going to really push my luck, I’d also ask that the ‘wrap around the data’ only happens when the plugin detects an appropriate page to link to already exists, leaving just bare data if no page to link to can be found.

    That’s what I thought (or hoped, probably) ‘dynamic hyperlinking’ would mean, anyway!

    That said, your workaround provides the answer I need to develop the site, so I’m very grateful for that.

    Best wishes,
    Howard

    Thread Starter dizwell

    (@dizwell)

    Sorry: by way of follow-up:

    Suppose my artist’s name is Alphonse d’Eve. WordPress turns that name into a page permalink of ‘alphonse-deve’.

    Unfortunately, the dynamic link being created in my table points to "https://.../Alphonse d'Eve/", which therefore doesn’t match and I get a 404.

    I’ve tried editing the WordPress permalink to add a “& #3 9;” where the apostrophe should be, but it keeps stripping it out… is there a way to process it out of the dynamically-created link so that I get a match to the apostrophe-less page, but still display the apostrophe in the ‘slug’?

    I realise that this is wandering far off the path of what the WP Data Access plugin can reasonably be asked to do!

    Regards
    HJR

    • This reply was modified 5 years, 1 month ago by dizwell.
    • This reply was modified 5 years, 1 month ago by dizwell.
    • This reply was modified 5 years, 1 month ago by dizwell.
    • This reply was modified 5 years, 1 month ago by dizwell.
    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Howard and Charles,

    Looks like you already have the artist name in the hyperlink. I’m not sure if I understand your “wrap around the data” requirement correctly, but I was wondering if a macro could help? Please see this section of the dynamic hyperlink documentation:
    https://wpdataaccess.com/docs/documentation/data-explorer/dynamic-hyperlinks/#macro-if-then-else

    If not, can you explain what you mean with “wrap around the data”?

    Thanks,
    Peter

    I’m not sure what Howard is after either. Perhaps an example would help.

    Secondly. Howard, you wrote about a problem with accented and apostrophes in names. That is major problem in web sites. Not confined to WPDA, MySQL or WordPress.

    I avoid the problem by never using special characters in any ‘technical’ reference. all lowercase and no spaces. However, in your case, that may force you to add extra columns with the URL text. I’m not telling you what to do, just what I do.
    wordpress deliberately does the same thing for the slug. The only easy solution is another column.

    Thread Starter dizwell

    (@dizwell)

    Hi Peter,

    I simply meant that my actual data says (for example) ‘Frank Bridge’, and by declaring ARTIST to be dynamically hyperlinked, I had hoped that "<a http://....com/>Frank Bridge</a>" would be created automatically. IE, the a-tag-and-close would be written “around” the plain data, in-place, without generating an entirely new column in the process.

    As it happens, however, whilst Charles’ suggestion means I can create a new, “dynamic”, column that I can then use to replace the “original” ARTIST column, I’m afraid my artists have all sorts of ‘foreign’ characters in them (such as František Xaver Dušek), and with WordPress’ propensity to strip them from permalinks, that’s making things tricky to create functioning links anyway.

    I’ve just installed the Permalink Manager Lite plugin to see if I can make my permalinks match the $$ARTIST$$ data in my WP Data Access table, but I’m having somewhat mixed results at the moment… so it’s quite possible that merely wrapping an a-tag around ‘plain data’ is not such a good idea after all, if your plain data isn’t entirely URL compatible in the first place.

    Thanks,
    Howard

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Thanks for clarafying Howard!

    That makes sense. The disadvantage of such a hyperlink column however, is that it uses only the value of the column it is defined on. The dynamic hyperlink column allows to use multiple column values. You know how user are? They always want more! 🙂 Over time the dynamic hyperlink column has in fact grown towards a kind of compute field that allows much more than only dynamic hyperlinks.

    Anyway, are you happy with this solution? Or not yet…? Let me know…

    Thanks,
    Peter

    Thread Starter dizwell

    (@dizwell)

    Yes, Charles’ workaround is a suitable fix for my issue. My data is simply not readily linkable, though: all those diacritic marks!

    But that’s something I shall have to fix at my end. I sense an additional column is needed in my table: actual artist name for display purposes and a English transliteration of it without using anything other than plain ASCII!

    Or maybe I’ll just stick to static linking after all 🙁

    Thanks for taking the time to think about it, anyway!

    Best wishes,
    HJR

    @dizwell Concerning your page id problem.

    Here’s a longer explanation, but not a solution. Every page and post in WordPress has a slug. The value of this is always, always lower case, no spaces, no special characters etc etc. It is also unique so if you create two pages with the same title the second will have a -2 at the end. But… you can also edit them as you have tried.

    The advantage of editing is that as it is almost impossible to get way from having a “pretty” text for an artist and a separate column with the page slug you can give it the value you want. This allows you to set the slug when you add a record to your database. I’m sorry it isn’t the answer you want but it is a feature of WordPress.

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    I would keep it like this Howard. You have the best 404 page I have even seen! 😂😂😂

    @dizwell

    I may have an answer for you.

    Instead of using an expicit url, use a WordPress Search
    `
    https://absolutelybaching.com/?s=Alphonse d’Eve

    It’s a compromise and may not be to your liking. But it eliminates that second Column.

    Thread Starter dizwell

    (@dizwell)

    🙂 Thank you for the 404 ‘like’!!

    Just to finish it off: I have experimented with a couple of ‘custom permalink’ plugins: I found them difficult to work with and they never seemed to work properly.

    In the end, though it may be the sledgehammer/nut problem, I have installed a ‘301 Redirects’ plugin. I provide the URL that appears in the WP Data Access table thanks to Charles’ workaround (which is the ‘pretty’ version of a composer’s name (otherwise known as ‘the correct spelling’!), and then set up a redirect to the URL that WordPress’s auto-permalink-mangling produces. And… it works. Links to Alphonse d’Eve and František Xaver Dušek are working fine, and I can display the hyperlink ‘in-place’ (or make it appear that that’s what I’m doing: thanks Charles!)

    It’s not exactly point-and-click, but it’s close enough for my hobbyist purposes.

    Thanks again to you both.
    Regards
    HJR

Viewing 15 replies - 1 through 15 (of 17 total)

The topic ‘Have I misunderstood dynamic hyperlinks’ is closed to new replies.