Django CMS only one entry in model - django-models

I want to make a persistent floating(using CSS) contact button on every page in Django CMS.
I need to get the first item in DB and construct the URL according to it in the template.
Also, the place holder should display first item and allow editing it everywhere if possible.
Or maybe not have an input at all and allow editing the contact info in the admin.
Or have an option to use the first one which is default or a different number for a particular page.
I have currently made my plugin but it creates a new entry every time.

If you want something to appear on every page you need to make use of static_placeholder (docs) which acts like a normal placeholder but you only need to add plugins to it on one page for them to appear in every page which you include the static_placeholder of the same name.
For example I often have a footer which includes a menu & allows a client to add their own content like contact address, phone number etc. The easiest example of how you could do this would be to include the following template tag in your base.html so that it gets included in all pages inheriting your base template.
{% static_placeholder "footer" site %}
Also the standard placeholder tag doesn't work in apps, so if you include apps in your CMS site via app hooks you can also include the static_placeholder in the app templates to add plugins.

Related

How can I create a 2sxc app that has a listing and details that open in a modal?

I want to create a 2sxc app that has a listing of items. When a user clicks on an item, it should open the details view in a modal window.
However, I don't want to simply load all items into the page and have a JS open the modal. Ideally, I would want the modal to load the content only when it's called. Also, ideally the URL would still in place similar to how there's a listing and details templates in an app.
Is this possible?
Yes, this can be done :)
It basically needs 3, optionally 5 steps
Open a DNN page without a layout
(optional) make sure only your module will be on the popup using mid=... parameter
Make sure you add the id/name-id/guid of the details in the link such as post=...
Create the razor view which shows the details, ensure it appears when the parameter is added
(optional) Create different urls for google / user so user sees the popup, google indexes a real page with the details view
1. Empty Skin / Layout
The trick is to open the page using the DNN parameter to either switch to the layout-free skin (print), or to another custom skin. This allows you to start with an "empty" page without stuff around it. Either use popUp=true in the url (the Up must have an upper case U) or a skin parameter to choose another skin
2. - 4 MID, url-parameter, name in url to select view
This MID is common - if you have mid=... DNN will not load any other modules on the page.
Same with the named url parameter for the details-id and view switching, so I won't document this in detail.
5. Different details for Google vs. Interactive
In case you want google to index the details view, that would probably want the indexed page to have a layout. So create a link to the details without the special popup, and on-click only change it to open the link with the popup feature.

How do I modify Drupal's Admin Screens?

I'm looking to edit Drupal's admin pages.
Some of the things I'm trying to achieve:
Remove is the the filter setting on the Content page/node/view. In other words, if I go to to the Content page and I filter by a certain type of node, then I leave that page, then come back, the filter setting is saved, I'd like it to reset each time I visit the Content page.
I would like to modify some of links associated with these pages, as an example on that Same Content page, the titles of the pages are linked to their 'front-end' views, I'd rather have them link to their 'edit' screens.
While I have been successful in modifying the front-end theme of Drupal, by editing the actual php files. I can't find the the same php files for the Admin theme. In our case we are using Seven (7.21). I've read something about views, and thought maybe the entire Admin theme is built as views, aka there no php files involved like the front-end theme has, but under the Views section I did not find any either. I'm still pretty new at this and coming from the Wordpress world, this is a Drupal is a lot different.
The logic for that section of the admin area is at (from the public root):
/modules/node
Specifically "node.admin.inc"
That being said, I don't recommend editing core scripts, as they will be overwritten when you update the core.
You could explore making your own module to supplement that page, or your own view or explore some pre-made modules, such as "Admin Views"
Find de view displayed and go to its configuration :
1 - Edit configuration view like suggested here : https://drupal.stackexchange.com/questions/44440/how-to-remember-exposed-filter-choices
2 - Rewrite output views to rewrite link : field https://www.drupal.org/node/1578524
Another option is to create and use your own dashboard/views to achive like you want http://definitivedrupal.org/suggestions/creating-custom-administrator-view-content
also you can see contrib module : https://www.drupal.org/project/admin_views
You don't have to use that default content overview page at all. Make your own instead:
Make a page view (you have to install views module if you already did not: https://www.drupal.org/project/views) and use table layout. Make sure that page paths starts with "admin" so it will use admin theme. Also pay attention about permissions, so only specific set of users (admins) can use it.
For that view you can freely select what columns you what to show. You can also allow ordering by any column and action if you click on some field.
Use exposed filters to add filtering form, again add any filters you need. You can even set the form to use AJAX, to do auto-submit when some filter field is changed, include reset button and more. Also for every exposed filed you can select (at fields settings) should it remember it's value or not.
At end, edit admin menu and add your new page to it so it will look and act as default one but will offer much more functionality. You can even totally remove default one from the admin menu.
Views module is very powerful, not only for front-end but also for back-end content handling.

Overwrite Metatag for an automatic generated page

I have the Metatag module in drupal 7.4 and it uses the title of the page for the Metatag. However there is one page in particular where the client wants another Metatag, this page is a generated page so I can't adjust it in the backend (with the module). My question is, is there any kind of way where i can adjust this meta tag? Jquery or in template.php with a check on pagetitle?
Greetings.

Creating an index page automatically

I'd like to have dotnetnuke build an index page based on pages that have a particular tabid. Are there any modules that do this already?
e.g. we create multiple pages under /News and then the index page lists links to all the news articles. Would be handy if we could also enter our own HTML text (maybe on the News article page itself) that is then displayed next to each link on the index page.
Thanks!
By default, there are no 'real' pages in DNN. Everything is served up in the Default.aspx from content that is stored in the database.
What you could do is create a module that populates data based on the TabId or Path. Then, there is a setting in DNN to make a module appear on EVERY page. Since the module is on every page, it could populate its data based on the TabId or the path, or just not show anything if it doesn't match your criteria.
For something like that, I used a module called SQLGridSelectedView from www.tressleworks.ca (I have no affiliation) and I wrote my own SQL to fill in the fields, and I defined a custom layout (instead of the default data grid) so I was able to do something like what you are asking without code.
There is a module from Ventrian called Child Links that does what you are talking about. You can use it to grab title & description from the pages below a relative to a specific page to build out menus etc.
It allows for formatting however you want as well.

Plugin for finding tags from content of post in cakephp

I am making one web-app using cakephp.
In that i want to use plug-in which can automatically find tags from content which is written by user so that user needn't have to write tags manually and if he/she wants to add more tags then he/she can add manually.
And my question is that is:
Is there any plug-in available for that in cakephp and if there is than how can i use that in my application????

Resources