Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#121 2017-01-21 08:36:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

Re: smd_macro: Create custom virtual Txp tags that do stuff

phiw13 wrote #303640:

it would be nice if you could publish an up-to-date version of this plugin

Done. I’ll update the OP too. Slacking, sorry.

I found the MySQL table bug yesterday while testing the macro above and was just checking to see if I could find any more before releasing a new version. Think it’s okay now, but please let me know if you find anything else.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#122 2017-01-21 09:38:55

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: smd_macro: Create custom virtual Txp tags that do stuff

Bloke wrote #303641:

Done. I’ll update the OP too. Slacking, sorry.

Thank you!

So far, no other major issue to report. The plugin imports your macro above and it works; I created a small macro based on the examples in the help file, everything works fine. As far as I can tell! as I have to familiarise again with the plugin.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#123 2017-08-22 14:36:57

david@druna.cz
Member
Registered: 2017-07-25
Posts: 41

Re: smd_macro: Create custom virtual Txp tags that do stuff

I was looking forward to this plugin but when I enter the macro i says Macro name not valid no matter what I enter. I did not install any other plugins. Might be some missing dependencies? I downloaded the latest plugin version listed here and I am running TXP 4.6.2.

Offline

#124 2017-08-22 15:35:16

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

Re: smd_macro: Create custom virtual Txp tags that do stuff

david@druna.cz wrote #306705:

when I enter the macro i says Macro name not valid no matter what I enter.

Your macro name is a single word, right? Or one that uses underscores? The Name becomes your new tag so it must conform to standard naming policy. e.g. you could name it gallery or img_list or batman_and_robin if you like. But not Image gallery or Batman and Robin.

From the plugin docs:

IMPORTANT: your tag MUST adhere to the following conventions:

  • an ASCII name — no foreign characters, hyphens or anything other than alphanumeric characters and underscores. In addition it may not begin with a number.
  • double check before saving that your tag does not have the same name as an existing Txp or PHP function. If it does, your site WILL blow up with nasty errors. The best way to avoid this is to make sure you prefix your tags with a three-letter prefix, just as you would if this was your own plugin.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#125 2017-08-24 17:45:28

david@druna.cz
Member
Registered: 2017-07-25
Posts: 41

Re: smd_macro: Create custom virtual Txp tags that do stuff

I tried every name possible including “abcd” and the message is always the same.

Bloke wrote #306706:

Your macro name is a single word, right? Or one that uses underscores? The Name becomes your new tag so it must conform to standard naming policy. e.g. you could name it gallery or img_list or batman_and_robin if you like. But not Image gallery or Batman and Robin.

Last edited by david@druna.cz (2017-08-24 17:45:43)

Offline

#126 2017-08-29 11:56:49

david@druna.cz
Member
Registered: 2017-07-25
Posts: 41

Re: smd_macro: Create custom virtual Txp tags that do stuff

Is there really nothing that can be done about it?

Bloke wrote #306706:

Your macro name is a single word, right? Or one that uses underscores? The Name becomes your new tag so it must conform to standard naming policy. e.g. you could name it gallery or img_list or batman_and_robin if you like. But not Image gallery or Batman and Robin.

Offline

#127 2017-08-29 12:31:04

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

Re: smd_macro: Create custom virtual Txp tags that do stuff

david@druna.cz wrote #306766:

Is there really nothing that can be done about it?

I’m not sure what else to suggest. It works fine on a vanilla 4.6.2 install for me so I’m not sure what could be going wrong. Any major issues listed in your Admin->Diagnostics panel? No stale code running from the browser cache?


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#128 2017-08-31 22:40:43

david@druna.cz
Member
Registered: 2017-07-25
Posts: 41

Re: smd_macro: Create custom virtual Txp tags that do stuff

Diagnostic were saying TXP cannot write into temp folder so I gave it permissions. The problems persist. There is another warning that there are various function turned off in the environment. That might be it! Im in communication with the host to turn it on. Quote of the warning in czech:

Následující funkce PHP byly na serveru vypnuty (ale mohou být nezbytné pro Textpattern): fbase64_decode, eval, fcurl_exec, curl_multi_exec, parse_ini_file, show_source, php, perl, apache_setenv

Bloke wrote #306768:

I’m not sure what else to suggest. It works fine on a vanilla 4.6.2 install for me so I’m not sure what could be going wrong. Any major issues listed in your Admin->Diagnostics panel? No stale code running from the browser cache?

Offline

#129 2017-09-01 08:49:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

Re: smd_macro: Create custom virtual Txp tags that do stuff

david@druna.cz wrote #306807:

The following PHP features have been disabled on the server… eval, …, parse_ini_file, …, php, …

Whaaat! php is disabled? It can’t mean that!

The parse_ini_file and eval functions are both used by this plugin. However, parse_ini_file should only be used when importing macros (and it silently fails if it can’t) so that shouldn’t be the issue. eval is used when interpreting the macro content, so it’s kinda vital. But only used on the public side, so it shouldn’t affect the issue you’re seeing here. This is baffling.

EDIT: you do have full permissions for your user that you’re running the macro plugin as, right? In theory it should only run for Publisher and Managing Editor accounts, but there may be an issue with the plugin where it renders the interface but can’t complete some later functions (like save). If that’s the case, I’ll have to fix it.

Last edited by Bloke (2017-09-01 08:52:43)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#130 2017-09-01 18:34:27

david@druna.cz
Member
Registered: 2017-07-25
Posts: 41

Re: smd_macro: Create custom virtual Txp tags that do stuff

Hurray! The admin enabled some of the features and it started working (I can create the macro, I have yet to test it further). It event fixed other issues – I could not create new sections before. There are still some missing features I hope I can do without them for some time. Current message is:

Následující funkce PHP byly na serveru vypnuty (ale mohou být nezbytné pro Textpattern): fbase64_decode, fcurl_exec, curl_multi_exec, fparse_ini_file, show_source, php, perl, apache_setenv

Bloke wrote #306812:

Whaaat! php is disabled? It can’t mean that!

The parse_ini_file and eval functions are both used by this plugin. However, parse_ini_file should only be used when importing macros (and it silently fails if it can’t) so that shouldn’t be the issue. eval is used when interpreting the macro content, so it’s kinda vital. But only used on the public side, so it shouldn’t affect the issue you’re seeing here. This is baffling.

EDIT: you do have full permissions for your user that you’re running the macro plugin as, right? In theory it should only run for Publisher and Managing Editor accounts, but there may be an issue with the plugin where it renders the interface but can’t complete some later functions (like save). If that’s the case, I’ll have to fix it.

p.

Offline

#131 2017-11-13 15:44:53

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: smd_macro: Create custom virtual Txp tags that do stuff

jakob wrote #245939:

Cool! and cunning. That works!

BTW: for those, like me, who may not initially understand the logic, it is ESSENTIAL to insert SMD_NONE (or a non-word of your choice) as the default value in the attributes section above the code:

I am checking an amended version of this macro out but it seems to be chocking after it parses the image tag

In the macro I have

<figure itemscope itemtype="http://schema.org/ImageObject" class="{class}">
<txp:image id="{img_id}" />
<txp:smd_if field="{caption}" operator="eq" value="SMD_NONE">
<figcaption><txp:image_info id="{img_id}"> type="caption" /></figcaption>
<txp:else />
<txp:smd_if field="NULL" operator="eq" value="{caption}">
<txp:else />
<figcaption>{caption}</figcaption>
</txp:smd_if>
</txp:smd_if>
</figure>

The tag I use in the write tab is

<txp:figure id="58" caption="my caption" class="grid_9"  />

the parsed code is

<figure itemtype="http://schema.org/ImageObject" class="grid_9">
<img src="http://respublika.neme.org/images/58.jpg" alt="" width="350" height="240" />

There is no figcaption and the closing figure.

Can anyone spot what I am doing wrong? I am using the 0.41 version of the plugin.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#132 2017-11-13 15:52:48

jpdupont
Member
Registered: 2004-10-01
Posts: 752

Re: smd_macro: Create custom virtual Txp tags that do stuff

A > to much —> <txp:image_info id="{img_id}" type="caption" /> ?

See the bad syntax highlighting …

Last edited by jpdupont (2017-11-13 15:54:10)

Offline

Board footer

Powered by FluxBB