I work in MODx Evolution and created a template variable which is an image. I want this image to be downloadable by my website visitors. Is that possible, how?
This link gives valuable info... but the issue with my requirement is the MODx template variable and the fact that I do not have a specific path to specify. ... similar Stackoverflow question answered
What is happening is that your TV output type is set to "image" - Modx will output an image tag in that situation and not just the path. You can change the output type to default so that only the path is output, then you can pass that to your download/push scripts. OR leave the TV type as is and write another snippet to retrieve the TV value, which will be the path & filename. Docs here
Something like:
/call snippet
[[!getMyTVvvalue? &id=`[[*id]]`]]
// snippet
$resource = $modx->getObject('modResource', $id);
return $resource->getTVValue('my_image_tv');
// might be handier to output it to a placeholder
$my_path = $resource->getTVValue('my_image_tv');
$modx->toPlaceholder('my_image_path', $my_path);
// output in your page
[[+my_image_path]]
Though it would be easiest to just change your output type.
Related
I want to create a link to an email address like somebody.
I tried to use a weblink resource (which gets an id of 20) with mailto:person1#provider.nl as link value and render this in my content with the tag [[~20?~]]. (and different variations of it)
But ModX renders it as somebody This is not what I want.
So how do I do this properly, so that I can reuse this resource in several places in the website?
This link needs to be editable for a 'Content editor' with reduced rights, so I don't think a chunk is the best way to go.
Because to do this you need to create weblink:
and this is works as expected in Wayfinder/PdoMenu:
UPDATE:
[[~20]] - will output alias field. You need to output content field. To do this use pdoField snippet (part of pdoTools):
[[pdoField?&id=`20`&field=`content`]]
I need an alternative to Google Custom Search for a website I look after, it has to be something that will crawl a website, index it, allow fiddling of priorities, and then allow search queries via REST or something similar and return XML or JSON etc. It needs to run on a Windows Server instance.
So, I'm up and running with http://www.opensearchserver.com/ and it seems to do the trick, but can't, for the life of me, work out how to get thumbnail images in the results? I've searched the documentation and read everything I could, but can't find out how to do this (or how to get my head around it).
I'm crawling standard web pages and they all have thumbnail meta data, which I'm assuming should be able to be parsed somehow for results and included in the JSON results?
Any pointers at all would be very helpful, thanks!
I figured this out, in case anyone else is struggling, here's how I did it. The answer is in the documentations, it's just not that simple.
Read: http://www.opensearchserver.com/documentation/faq/crawling/how_to_extract_specific_information_from_web_pages.md - it contains the method
Assume you set up a 'web crawler' index.
Assuming you're using a meta thumbnail like this:
<meta name="thumbnail" content="http://my_cdn.com/news/images/29637.jpg">
Go into Schema / Fields. Add a new field called 'thumbnail' with index no, store yes, vector no, analyser Text, copy of blank. Save that.
Now go to schema / parser list, edit HTML parser. Go to 'field mapping', now add a new regex for the thumbnail in the html. We map from the 'htmlSource' to the thumbnail' with the matching regex.
My imperfect regex (that works though) is:
htmlSource -> linked in: thumbnail -> captured by:
(?s)<meta name="thumbnail" content="(.*?)">
Now SAVE this and go to crawl/manual crawl, enter a url that has a thumbnail and then check if the field now appears in the list below when it's read. If not check your regex, and check you actually saved the HTML Parser changes.
To get the thumb in your results, simply add the fieldname to the JSON you send with the query:
"returnedFields": [ "
"url",
"thumbnail"
],
I am looking to use Blockly to allow non-techie users to specify test scripts.
One part of it will require a File Selector, however, I can't see that Blockly has one. Does it?
Actually, I can't find a complete list of standard blocks. Does anyone have a URL?
If there is no standard Blockly File Selector, (how) can I access the Windows File Selector? (and how, in general, can I execute DOS commands?)
As far as I know, I think that you cannot get a File Selector from Blockly but maybe this post is useful for you in which a man creates a custom Block for this purpose.
Also, I could not find a list with only the names of all the standard blocks but I saw that on the playground of Blockly you can see all the standard blocks that Google provides to you. If you want to see the code of all of them you can see it on Blockly GitHub.
I suppose that if Blockly does not have a File Selector it will not also has access to the Windows File Selector but maybe you can create a custom Block for that purpose via Javascript (I do not know what programming language are you using for). This link can help with Javascript Windows File Selector.
I expect it will be useful for you!
You can override the showEditor_ function on a blockly input - this works quite well with FieldTextInput. See https://youtu.be/eYHo0VeSLCI for an example of an 'intercepted' click opening a jquery mobile dialog, that then fills in the text value. The text value is then retrieved by the javascript generator to load the selected file at 'runtime'.
I've pasted below some cut down code:
Show a standard text input
let fileInput = new Blockly.FieldTextInput('** CHOOSE A FILE **')
Then you can attach a click handler which would show your file selector - so the standard browser file selector may do...
fileInput.showEditor_=(()=>alert("Intercepted"))
You'll need to replace the alert with your file selector code. Your code will also need to set the value of the text input - with something like this:
let block = Blockly.mainWorkspace.getBlockById(block_id)
block.setFieldValue(filename, widget_id)
Where widget_id identifies the text input and block_id the actual containing block.
I am beginner to Orchard. My purpose of starting this discussion is, to make beginners aware about Orchard Fundamentals.
I am currently Developing on web site using Orchard. But most of the times I am facing difficulty in rendering contents and how to place content on front end. As well, use of content items, content types and modules. Usually, I get confuse in using all these things. For example : I have created new content type for displaying latest post on my site, with date and user's profile picture. So for that my question is, "Is it right that I have created content type for it? or should I have to make module? and if yes than can I use my content type as a widget on my homepage? "
FYI: I went through the documentation and plural sight's video. But I was not able to clear above fundamentals.
Sorry for any inconvenience or any stupid questions, but at this time it seems bit complex for me. Can anybody please help me to clear my fundamentals of orchard?
Thank you,
Sohil Shah
I am currently Developing on web site using Orchard. But most of the times I am facing difficulty in rendering contents and how to place content on front end. As well, use of content items, content types and modules. Usually, I get confuse in using all these things. For example : I have created new content type for displaying latest post on my site, with date and user's profile picture. So for that my question is, "Is it right that I have created content type for it? or should I have to make module? and if yes than can I use my content type as a widget on my homepage? "
Is it right that I have created content type for it? or should I have to make module?
Sure, a ContentType just means that you can create instances of that specific type through the CMS.
or should I have to make module?
Do you want to re-use your contenttype across different projects? If so, then you should create code that creates the contenttype for you (in a migration script) and put that in a module.
can I use my content type as a widget on my homepage?
Yes, you need to enable your contenttype to be a widget. You can do this also with a migration script like so (add the WidgetPart and settting Widget stereotype:
ContentDefinitionManager.AlterTypeDefinition(
"MyWidget",
x => x.WithPart("WidgetPart")
.WithSetting("Stereotype", "Widget")
);
mywebsiteurl.net/image.jpg?9a7ad6
What is this "?9a7ad6" after each image link? I noticed this when I copy pasted the url of an image.
I googled it, but the only relevant thing that I could find is that #9a7ad6 is the hex code for purple.
Some WordPress themes/plugins use query strings to do neat things to images on the fly like resizing. In this case, the query string (stuff after the ?) is likely being used to prevent caching. If that is the case, here's how to fix it:
There's a setting under Browser Cache → General that says Prevent
caching of objects after settings change → Whenever settings are
changed, a new query string will be generated and appended to objects
allowing the new policy to be applied. Disable that (if you're using
the plugin) and those query strings will be dropped on static
resources like .jpg and .png files.
Source: Philip Arthur Moore from WordPress.org: http://wordpress.org/support/topic/wordpress-32-images-show-weird-query-string
You may also want to take a look at this page: http://diywpblog.com/wordpress-optimization-remove-query-strings-from-static-resources/