I would like to find all instances of a string throughout my entire Django CMS site. I imagined I would find a database table containing the text of all the Text Plugins that I can search through.
I also want to replace the string with a different string, but main issue is just finding where this is stored.
The text content of the Text Plugins is stored in table djangocms_text_ckeditor_text
And then I was able to use replace():
UPDATE djangocms_text_ckeditor_text
SET body = replace(body, 'foobar', 'fizzbuzz')
WHERE body like '%foobar%'
Related
I have an entity page and i would like to add blocks of different types and display them in the form when i select one (Image, text and image or just text). All dynamically without being pre-defined in the administration (like a cms).
HomePage
title
description
blocks [text, text-image, image]
if text create new field text
if text-image create new field text and new field image
if text again create new field text
I dont know how to make a form to be like reapeater one with adding new block or removing existing one.
I can't comment so I will put an answer instead.
I am not sure I get your question. If you're trying to configure the fields, you need to configure them in your CrudController:
TextField
ImageField
etc. as per the documentation
If you're trying to have a more CMS like approach, where you can move things around, you may want to check SonataAdmin instead. It is much more complicated but provide CMS capabilities EasyAdmin does not.
I want to add some text to 'title' on admin/content page, based on content type.
for ex. if any article title is 'this is test article'. I want it to be displayed on this page like 'this is test article SOME EXTRA TEXT'.
I want to do it for 3 4 content type. for every content there will be different extra text.
How can I achieve it ??
Easier and yet more powerful solution would be to create your own content overview page. Create a page view that will list content. Use table format and set some back-end path to that page so you'll get the admin theme for it and it will look (almost) identical to original one. Or, make it even better - add more filtering options, make content sortable by other colomns (except for "Updated" field")...
When you do that for every field you'll have many options including most powerful one - to execute some php code on original content to generate different one...
And you can edit admin menu, to add your new page to it (eventually replace original one).
My client has a bizarre request which is making it difficult to build a slideshow on profile2 pages: The profile2 pages require 4 photos to be uploaded, and he does not believe that the users adding content to the site will "get" the multi-select method found in most file upload modules. The Field Slideshow module only works if you're using multiupload (which of course makes sense), and that's how I had it set up initially - which worked perfectly. I've tried using the field collection module, then creating a Slideshow view, but the image fields in the field collection field aren't being seen as a group. I think I had to select one of the 4 image fields to use instead of all 4. Any ideas?
he does not believe that the users adding content to the site will "get" the multi-select method found in most file upload modules
This hardly makes sense, I guess you tried to explain things to your client ?
Assuming you have several image fields on your content type, you could build a view which create a list (unformatted or HTML list) of these fields, maybe using a global field rewriting (you add all your image fields, exclude them from display, custom their display by removing field wrapper and field+label wrapper (in order to get only ), add a global text field in which you include image fields token), and then create your slideshow in a custom javascript file, using whatever library you like (Cycle2 is great).
Your global text field would look like :
<div class="wrapper cycle-slideshow">
[field_image]
[field_image_1]
...
</div>
(with cycle2 adding a cycle-slideshow class will initialize your slideshow)
...but you need token to do so.
I often find it more convenient to setup javascript things like that (slideshows, gmaps...) by myself instead of using views integration.
Hope I understood your issue correctly, good luke with this.
For every (custom) field you have option "Number of values" which you can set to fixed amount (i.e. 4) or unlimited. Can you use that?
Easier: Use Rules. Create an additonal (fifth) image field (multivalued) that will be the one consuming the slideshow. Create a new Rule, triggered on creation or update of your content with 4 actions: each one adding the content of one of the fields to the multivalued field list. You probably need to avoid showing that field but that depends on what are you using to display, so hide it using display suite or just not using it in the content template. This way, you show your users your 4 fields but makes the slideshow work based on a computing of the user inputs.
I want to WYSIWYG editor like tiny mce or ck editor to add product description, the issue is , the user can add images using built in image uploader available in the editor within the html. Within the database i have 4 fields , producttitle, productdescription ,productimage. I am out of ideas of how will i save the images in the productimage field/ if i dont use that field how the editor will save images including the html in the productdescription field. Any suggestions or assistance will be appreciated.
Thanks
That depends on your website structure. Generally we need a separate upload field and then we store the path in database. With that way you can retrieve producttitle and productimage in order to list your products. Also with that way you keep all your product pages structure the same. I explain, let's say you have your product image on the left and the description on the right. If you want anytime to change this structure you modify one file, otherwise you will need to modify each product description field.
However it's necessary to have also an uploader on your WYSIWYG editor. You maybe need it once to add extra images or some icons. In addition, it's nice to make things easier, not only for you, but for the client. In general clients like things that they are already used (MS Office) like a complete WYSIWYG.
I'm fairly new to Drupal and really only working on it for a client, but I've got a group of images I'm outputting into a list / gallery, however for a js I've written to do some nifty sorting and such, I need to have the keyword tags saved with the image to be output into the Alt field.
Is this a "replacement pattern" or even possible? Any resource links or code snippets would be greatly appreciated!
You can use tokens in imagefields if you enable the imagefield_tokens module. The taxonomy terms should be available as replacement patterns on the field settings form under "ALT text settings" (the token you probably want is [term-raw]).