Forumlar / Cotonti / Support / A little extended pagetextbyid

12>>>

staleo
#1 2015-04-28 20:43

Hi folks,

Maybe you could help me with my issue. Do you guys remember pagetextbyid plugin, which fetches a page's text with an id and puts in anywhere you like? How about not only text, but anything else, like titles, extrafields, whatever? So that I could also use regular Cotonti expressions, like IF, in my page.tpl?

Are there any ways to extend pagetextbyid somehow, or even a plugin?

Thanks in advance!

Dayver
#2 2015-04-30 01:11

Try this modification github.com/Dayver/cot-pagetextbyid special for you. Plz test him

Pavlo Tkachenko aka Dayver

Bu konu Dayver tarafından düzenlendi(2015-04-30 01:16, 8 yıllar önce)
staleo
#3 2015-04-30 12:43

Hi Dayver,

Thank you for a modification, but it seems not to handle page's extrafilds. Text goes fine, title goes fine, etc, but as for any extrafields, it simply outputs Err. Unknown field.

Dayver
#4 2015-04-30 15:31

Plz write an example of calling a tag with an extra field and how his named in database/

Pavlo Tkachenko aka Dayver
staleo
#5 2015-04-30 20:18

You mean, an example of an extrafied I use? Like, {FAKEL_LOGO}, for example.

Dayver
#6 2015-04-30 20:33

No, How you insert tag in tpl? I test work with extra fields and plug work fine.

Pavlo Tkachenko aka Dayver
staleo
#7 2015-04-30 21:17

Wow, nice! For some reasons, it didn't work for me last time, but now, the global tag like {PHP|pagefieldbypid(521, 'game_stadium')} works awesome, thank you!

But let me little extend the plugin's possible implementation. How about if I make a new global, like, {PAGE_TO_FETCH_FROM}. While editing a page, I input an other's page id into it, and a first page comes up with some of the fetched thing from the second page.

In terms of pagefieldbypid from you, Dayver, the global tag must be sort of {PHP|pagefieldbypid({PAGE_TO_FETCH_FROM}, 'text')} which of course doesn't work. How to make it go fine?

update:

Oops, pagefieldbypid seems to work a little unstable. First, I added a global tag {PHP|pagefieldbypid(518, 'fakel_name')} in a footer.tpl just to make sure it's fine. It was fine. Than, I added the same tag into a page.tpl, and the both places tag output nothing! Hmmm.

Dayver
#8 2015-04-30 21:57
#40851 staleo:

But let me little extend the plugin's possible implementation. How about if I make a new global, like, {PAGE_TO_FETCH_FROM}. While editing a page, I input an other's page id into it, and a first page comes up with some of the fetched thing from the second page.

In terms of pagefieldbypid from you, Dayver, the global tag must be sort of {PHP|pagefieldbypid({PAGE_TO_FETCH_FROM}, 'text')} which of course doesn't work. How to make it go fine?

update:

Oops, pagefieldbypid seems to work a little unstable. First, I added a global tag {PHP|pagefieldbypid(518, 'fakel_name')} in a footer.tpl just to make sure it's fine. It was fine. Than, I added the same tag into a page.tpl, and the both places tag output nothing! Hmmm.

Try instead {PHP|pagefieldbypid({PAGE_TO_FETCH_FROM}, 'text')} put {PAGE_TO_FETCH_FROM|pagefieldbypid($this, 'text')}.

Strangely, I checked and in me one the same tag placed in different patterns worked everywhere and do only once request to the database because in this modification added caching.

Pavlo Tkachenko aka Dayver
staleo
#9 2015-04-30 22:27

Nope. In my case, {fetched_article|pagefieldbypid($this, 'text')} outputs nothing. :( Siena 9.14, just in case.

Dayver
#10 2015-04-30 22:33

fetched_article - what is it. and where

Pavlo Tkachenko aka Dayver
staleo
#11 2015-04-30 22:43

Look. On a page A I need to put a text fetched from Page B. I create an extrafield fetched_article, input a Page B's ID there. Than, in page.tpl I insert {fetched_article|pagefieldbypid($this, 'text')} and than, on a Page A, there isn't anything fetched from page B.

Dayver
#12 2015-04-30 23:25

Then this {fetched_article|pagefieldbypid($this, 'text')} not correct. Correct need {PAGE_FETCHED_ARTICLE|pagefieldbypid($this, 'text')} in same form (important to have the prefix "PAGE_" and right - upper case).

Plz may be in PM? Or Skype?

Pavlo Tkachenko aka Dayver
Kort
#13 2015-05-04 04:03

Pagelist does it all and more out of the box

SED.by - создание сайтов, разработка плагинов и тем для Котонти
Dayver
#14 2015-05-04 05:41
But without cache
Pavlo Tkachenko aka Dayver
Kort
#15 2015-05-06 10:25

Cache is good only theoretically. In practice it is useless and can easily be discarded.

SED.by - создание сайтов, разработка плагинов и тем для Котонти

12>>>