I have a question regarding Drupal 7 and the Views API.
I'm writing a module that replaces specific text in views. Essentially what I'm trying to do is scan text in a view (or page for that matter). Let's say the view has [special button] will be replaced with
l(t('button'),'mypage',array('query',array('page'=>$node->nid)));
Or whatever. Please understand this is pseudo code.
I've took a look at hook_view(), hook_node_view() (http://api.drupal.org/api/drupal/modules%21node%21node.api.php/function/hook_node_view/7) and neither of them seem to work for me.
I've also looked at http://drupal.org/node/1510828 but that didn't seem to help me out.
Have you tried selecting 'rewrite the output of this field' on the field/s ?
Or alternatively Views PHP should be able to do what you want.
Related
When you create a news or blog tab with CMS it's really easy to make a feed of posts with content preview. Also when you follow a link to a particular post you can notice that it consists of a different html tags and css styling and not just plain text. It just uses rich text editor. So just getting text from db is not enough.
My question is how to achieve the same result when making a website from scratch. It doesn't matter what language is used for back-end. I'm just interested in the idea how to do it. But if you could provide a code examples (with any language) it would be greatly appreciated
Ok I've figured it out. Posting the answer for somebody who will have the similar question in the future.
The idea is that you need to put a text with html tags into your database and then to retrieve it you need to put it in your desired div in unescaped state. The thing is that almost all view (template) engines escape html tags by default. To do that you have to use some built in functions specific to that view engine.
To put the article with html tags in db you can just write raw html into input field or you can somehow add richtext editor to input field. Richtext editor will generate html for you.
I've researched it and found out that that's exactly how cms work.
So there you have it. If you want to add something feel free to do it
I've never used Drupal before (development or managing content). I was asked to extend the admin content page to have a filter and simply don't know enough to get moving quickly.
Can anyone tell me if adding a search by text filter in the admin content area requires code or is there a CMS feature like adding a node for this task.
If code is required, is there something like a hook for this area? Not sure where to start. I will be investigating on my own but pointers to get me oriented to Drupal would help.
By default Drupal provides search mechanism ready to use. But there are also additional module which can improve search experience. You don't need any coding to use that search. You already have search form block ready to use.
Go to Structure -> Blocks and find block called "Search form". Now all you have to do is to put that block in some region and it will appear on front-end. Of course if it's not already styled by your theme it may be needed to put some extra CSS to make it look nice. There are also some template files which you can override and put some your HTML if you need.
There's also template file for search results page (which of course will work out of box also).
You may also need to create new block region if you want to place your form at some specific place, not covered by any existing region defined by your theme (easy thing to do!).
See https://drupal.stackexchange.com/q/30633/101329, the "Admin Views" module lets you configure the search form as you like.
I am new to drupal views. I know how to basically use views from from end i.e creating some views.
I wanted to know if i can create a view from my module and how do i theme a view that i have created.
Is there any clear ebook or something regarding this. I tried 1 book, But i felt it was not good explanation in it.
This is a fairly large subject. There are a lot of tutorials for Views & Panels out there.
Here's a link to the blog of the Views module author Angry Donuts, you'll find a link to the book he has written.
Have you checked drupal.org? You should find links to video tutorials and a lot of info about Views.
Is the question about theme views or programmatically create it? you can theme view by adding your own custom template for view, view field, view list, etc etc etc.
Now, create view or go edit some, at Basic settings, press Theme:information, and you'll see active template for each element of the view. So, you can copy required views template from views/theme folder to your_active_theme/templates, give it proper name (as written in Information pane), and press rescan in Theme: information.
After this, you should see your template highlighted.
That's actually it.
As for programmatic way of working with views, I suggest to create view via interface, and then call in in your module, and theme as you wish.
Please see this post for details.
I am using drupal 6. I created a content type called 'Mobile' using CCK and added content for it. I want to change the way the content is displayed to the user. How do i do this.
Currently looks like this. I want to play around with the fields in this only for this content type. How do i do it and can i do some work around with the form of the mobile content type.
Questions like "teach me how to walk"
You need to learn Drupal theming system. you can get general idea http://drupal.org/node/17565 and by looking at node.tpl.php from your theme - that's for the beginning.
P.S: as far as I see from your other questions, you didn't tried to search in the web for this.
I currently have a normal SharePoint list with about 15 columns or so. I need one of the columns to have a list of links. I know SharePoint lets you have 1 link and it also lets you have multiple lines of text... So I thought it would be there as an option, but no such luck. Anyone knows a solution for this? I wasn't able to find any info online, which doesn't happen often. I guess I wasn't looking for the right keywords? If anyone can point me into the right direction, it would be great!
Thanks
-V
Maybe a multiplelines text field, and configured it to be Enhaced Rich Text enable. It would allow you to insert your links as in a HTML page (it would be the same as to use a CEWQ)
We have a custom filed CALLed Document Link Field that enabled you to link multiple documents to a list item, maybe this is what yuo are looking for. In any case either you need a custom field, or use a multiple lines of text
Infowise Document Link Field