• Resolved peteraylmer

    (@peteraylmer)


    I’m massively revamping my site and using OS DataHub Maps to do so. Current URL is a development site not the finished article.
    I was getting on fine till I tried to load a markerfile.txt file with markers and html refs, so that I could display five markers with place names, each with a hyperlink to a page on which a walk starting from that place appeared. As I understand it, this would be linked in to [osmap markerfile=”https://…/markerfile.txt”%5D
    Simply, WordPress would not allow me to download a .txt file as media. Is there any workround to this?
    Here’s the first line of the .txt file:
    TL81063051;Hadleigh

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

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author skirridsystems

    (@skirridsystems)

    I’m really surprised at that, but it seems you’re right, .txt files are not an allowed upload type by default. I will add that in the next release.

    In the meantime there are various plugins which allow you to specify additional mime types for upload. This one for example:
    https://en-gb.www.ads-software.com/plugins/wp-add-mime-types/

    I’ve not tried it myself, so this is not an endorsement!

    Perhaps switch to using “markers” instead of “markerfile”? Although the plugin documentation clearly says that, in the markers attribute, “Labels, if present, must be simple text.”, I have had success including <a> tags that use single quotes instead of double quotes for the link’s attributes.

    In your example, markers="TL81063051;<a href='https://trailmanco.wwwnl1-lr5.supercp.com/england/east/essex-extras/hadleigh/' rel='nofollow ugc'>Hadleigh</a>"

    WordPress parses a shortcode incorrectly if an attribute includes double-quotes, whether or not you try to escape them. But single quotes seem to get through OK.

    • This reply was modified 4 years, 3 months ago by timjh.
    • This reply was modified 4 years, 3 months ago by timjh.
    Thread Starter peteraylmer

    (@peteraylmer)

    Thanks both. Your version works timjh at least it does when I call the town Halstead instead of Hadleigh, I’m forever confusing them. But yes please skirridsystems to an update that allows a .txt file!

    Thread Starter peteraylmer

    (@peteraylmer)

    Or so I thought. The code takes the first OS grid ref (the Halstead grid ref shown above) but subsequent ones are rejected as not being a valid lat long. I could translate them to lat long, but why aren’t the subsequent grid refs allowed? Possibly a glitch because I’m not using the code as I should do and maybe I’d better wait for the next release after all.

    Is your markers string syntax correct? Please show!

    Thread Starter peteraylmer

    (@peteraylmer)

    Thought so but you never know … works for Halstead on its own but not with the others …

    [osmap zoom=”3″ width=”900″
    markers=
    “TL81063051;<a href=’https://trailmanco.wwwnl1-lr5.supercp.com/england/east/essex-extras/halstead/&#8217;
    rel=’nofollow ugc’>Halstead|
    TL897189;<a href=’https://trailmanco.wwwnl1-lr5.supercp.com/england/east/essex-extras/messing-and-layer-marney/&#8217;
    rel=’nofollow ugc’>Messing and Layer Marney|
    TQ925930;<a href=’https://trailmanco.wwwnl1-lr5.supercp.com/england/east/essex-extras/paglesham/&#8217;
    rel=’nofollow ugc’>Paglesham|
    TL514248;<a href=’https://trailmanco.wwwnl1-lr5.supercp.com/england/east/essex-extras/stansted-mountfichet/&#8217;
    rel=’nofollow ugc’>Stansted Mountfichet|
    TL679410;<a href=’https://trailmanco.wwwnl1-lr5.supercp.com/england/east/essex-extras/steeple-bumpstead/&#8217;
    rel=’nofollow ugc’>Steeple Bumpstead“]

    It’s possible that your example has been mangled when displayed in this forum, but I found several problems. There are some strange quotes that are not standard ASCII double or single quotes, there are some newlines and there are no closing </a> tags.

    After a bit of editing I found that this string works:
    [osmap zoom="3" width="900" markers="TL81063051;<a href='https://trailmanco.wwwnl1-lr5.supercp.com/england/east/essex-extras/halstead/' rel='nofollow ugc'>Halstead</a>|TL897189;<a href='https://trailmanco.wwwnl1-lr5.supercp.com/england/east/essex-extras/messing-and-layer-marney/' rel='nofollow ugc'>Messing and Layer Marney</a>|TQ925930;<a href='https://trailmanco.wwwnl1-lr5.supercp.com/england/east/essex-extras/paglesham/' rel='nofollow ugc'>Paglesham</a>|TL514248;<a href='https://trailmanco.wwwnl1-lr5.supercp.com/england/east/essex-extras/stansted-mountfichet/' rel='nofollow ugc'>Stansted Mountfichet</a>|TL679410;<a href='https://trailmanco.wwwnl1-lr5.supercp.com/england/east/essex-extras/steeple-bumpstead/' rel='nofollow ugc'>Steeple Bumpstead</a>"]

    Some of the links go to “HTTP Referrer not valid”, which I assume is deliberate, but the Hadleigh Halstead one works!

    For this forum, it’s best to enclose example code in <code>...</code> tags.

    • This reply was modified 4 years, 3 months ago by timjh.
    • This reply was modified 4 years, 3 months ago by timjh.
    • This reply was modified 4 years, 3 months ago by timjh.

    Uh-oh. After a bit more testing, I realised that there is a problem with setting this string in the WordPress Classic editor. It all falls apart in “Visual” mode. At least in my test environment, the shortcode needs to be entered in “Text” mode, and kept that way – switching to “Visual” will clobber it by changing single quotes to double quotes and who knows what else.

    Thread Starter peteraylmer

    (@peteraylmer)

    Thanks @timjh, grateful for your time and trouble, well beyond the call of duty. I know enough that I should have thought about pasting in text mode. I’ve cut and pasted your code and everything works. (Yes, only the Halstead link live at the moment, but the others will follow soon. Full site relaunch in a week or so.)
    But @skirridsystems, getting the .txt anomaly fixed would be grand too!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘markerfile.txt download issue’ is closed to new replies.