Hi everyone,
what I am imagining is using a tag not for calling a chunk or snippet, but for a resource. This way, I think, I could use TVs to create content fields in resources which I could then include as "text components".
I suspect there is no modx core syntax to call resources directly. Is that true?
Well if so, how could I do it? Can getResources give me the whole resource with the template it uses, not just the content?
Thanks,
René
-
☆ A M B ☆
- 2 Posts
You may try getResourceField on package manager, it’s a snippet for getting specified infos of a resource based on its id. You can use it to get content, TV values or whatever you want. I dont know why you should create a text component while we have text and richtext TVs to attach additional info to a resource. Um, well modx has so many ways to get things done...
-
☆ A M B ☆
- 24,524 Posts
I’m not sure that I understand. A completely generated resource, template and all, would be a complete web page, with head and body tags. Embedding this in another resource wouldn’t work at all, unless you want to load it into a frame, in which case the source of the frame would simply be the URL to the desired page.
For Evo’s QuickManager front-end editor I do use resources with no template, and use Ditto to display the resource’s content with an "Edit" button. This is handy for easy access to things like footers with addresses and such that are subject to change.
Thank you for your replies!
@xgenvn: Well, the reason is this. I’d like to collect a number of possible "content row configurations", such as:
50% row width goes to a text element, 50% goes to another text element, or
75% row width goes to a text element, 25% goes to a picture, and so on.
These types should be choices I can make for a resource by using a TV.
I’d also like to use a TV to determine the number of such content rows.
Based on the number of rows and types of the elements, I should then be given another set of input fields where I can enter all the little content items.
@sottwell: I’d have the templates without these outer elements, giving them the sole purpose of using TVs to assign additional content fields of the correct type to the resource.
I would have these "inner" resources embedded into a resource that uses a more complete template, resulting in a complete webpage with complex content areas of different types, all entered via TVs.
Hey all,
I know it’s an older entry but has anyone an solution? Cause I have exactly the same question.
Thanks,
Torsten
You can use getResourceField or an @RESOURCE TV to get just the content field. I don't see any reason why you can't put everything you want to pull in into the content field.
If you do want the whole resource for some reason, you could write a simple snippet that used cURL to grab it, though that could be fairly slow.
TBH, I don't understand the use case described above, but I suspect that there are faster and cleaner ways to accomplish the goal. Resources are fairly heavy objects and it's not at all efficient to use them for data storage.
It might be worth looking at MIGX for this.