SitePoint Sponsor

User Tag List

Results 1 to 24 of 24
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2009
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Drupal 7 "older polls" page theming/templating

    I was looking at the output for Drupal's list of polls (the page that appears at example.com/poll) and thinking that it is frankly a bit cr@p. No page title (though that may just be a Snafu in my theme), no bulleted list (it's crying out for that) and poor text formatting.

    Can I create a custom template, like you can for some other output that doesn't have a core template? Or, is it a task for the dreaded template.php overrides (which I always hate trying to come up with)?

  2. #2
    SitePoint Zealot bronze trophy
    Join Date
    Jan 2012
    Posts
    116
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mat30 View Post
    No page title (though that may just be a Snafu in my theme), no bulleted list (it's crying out for that) and poor text formatting.
    Sounds like it's time for someone to start flexing some CSS muscle.

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2009
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But that cannot do anything to fix the absence of a list element, the absence of a title or the bad text formatting ("I mean, hyphens instead of em dashes? Really, Drupal developers, you should do better"). Sounds like it's time for someone to start reading posts more carefully.

  4. #4
    SitePoint Zealot bronze trophy
    Join Date
    Jan 2012
    Posts
    116
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mat30 View Post
    But that cannot do anything to fix the absence of a list element, the absence of a title or the bad text formatting ("I mean, hyphens instead of em dashes? Really, Drupal developers, you should do better"). Sounds like it's time for someone to start reading posts more carefully.
    Well, then I look forward to your version of this older polls thing ... after you perfect it and contribute it.

    By the way, I believe there should be a file in modules/polls named poll-results--block-tpl.php. Copy that to your theme folder, and you can adjust how poll data is displayed in that template file, if I'm not mistaken (it's been a while since I've used a poll). Also double-check your poll block to make sure the title is published, along with the module's configuration to make sure you're not missing something.

  5. #5
    SitePoint Zealot
    Join Date
    Sep 2009
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    poll-results--block-tpl.php is not related to this in the least. This is about output that is not controlled by a template. I can't make it any clearer.

  6. #6
    SitePoint Zealot bronze trophy
    Join Date
    Jan 2012
    Posts
    116
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mat30 View Post
    poll-results--block-tpl.php is not related to this in the least. This is about output that is not controlled by a template. I can't make it any clearer.
    I don't know about the whole "can't be any clearer thing." You could probably work on that part a little more -- no offense. Anyway, assuming we're talking about the Polls module (which I believe we are), then the templates are where you would control all of the output and how it is to be displayed, from the title to the votes, links ... everything is available to you as variables that you decide how to display or whether to display it at all.

    Example: " <h1>$title</h1> " would display your title in an h1 tag.

    Conversely, "<span style="color:red;">$title</span>" would take your title and make it red and and so on and so forth.

    If it's a problem with the data itself, then you could do a template preprocess function (template_preprocess_poll_results()), or modify the module itself.

    Unless this is some "special" drupal module that does everything completely different from every other module, which I somehow doubt.

  7. #7
    SitePoint Zealot
    Join Date
    Sep 2009
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I referred specifically in my first post to the
    list of polls (the page that appears at example.com/poll).
    This page's output is not altered by templates from the Poll module. I don't see how I can put it any clearer than I have. Hence asking whether a custom template, such as can be used for theming content that does not have an existing template (e.g. the contact form), would be a solution.

  8. #8
    SitePoint Zealot bronze trophy
    Join Date
    Jan 2012
    Posts
    116
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mat30 View Post
    I don't see how I can put it any clearer than I have.
    I could give you a lot of suggestions on how you could put it clearer.

    For example: "My issue isn't with how the individual polls are displayed, but how they display as a list, and within that context only. I want control specifically over the list view."

    That would have been much clearer, but that's neither here nor there. Anyway, if your issue is with how they are viewed as a list, then you should be using VIEWS to put together your list of polls, and this will give you the control over their display that you're looking for.

    Good luck.

  9. #9
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,021
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mat30 View Post
    I was looking at the output for Drupal's list of polls (the page that appears at example.com/poll) and thinking that it is frankly a bit cr@p. No page title (though that may just be a Snafu in my theme), no bulleted list (it's crying out for that) and poor text formatting.

    Can I create a custom template, like you can for some other output that doesn't have a core template? Or, is it a task for the dreaded template.php overrides (which I always hate trying to come up with)?
    Ok, I'm a little late to the game but I don't really understand what your issue is with Polls. I haven't had the need for using Polls before but I fired them up on a D7.12 site just to have a look and made a simple Poll to test them out. on my list page (example/poll) the title is where it should be and the polls are listed in a standard unordered list.

    HTML Code:
    <h1 class="page-title">Polls</h1>
    
    <ul><li><a href="/content/what">What is this</a> - 2 votes - open</li></ul>    
    
    I'm pretty sure this is the formatting you wanted and it's right there out of the box.
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  10. #10
    SitePoint Zealot
    Join Date
    Sep 2009
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That does not reflect at all the output that I get. Take away your H1 and replace your list items with divs and you are closer to what I see. And, even if I could determine why your installation has produced those elements, your example snippet still has the poor text formatting after the anchor that—as far as I am aware—cannot be altered.

  11. #11
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,021
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Everything that is outputted to the browser can be altered. You can either alter using _ _ _ tpl.php or template.php but that doesn't explain why you're getting the results have described.

    Something must be broken by your theme or some custom code somewhere. The site I ran my test on is a bare bones D7 installation. It contains zero custom code and I'm running an unadulterated copy of the Taraski theme (http://drupal.org/project/tarski) because I wanted it to look pretty without having to write a theme for it.

    Edit: I see your point about the text formatting in the anchor. I think that should be able to be changed via one of the poll template files but if it really bothered me I'd follow CMS_Dude's lead and make a new list with views so I could fine tune it exacty the way I want it to be.
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  12. #12
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,021
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Just another bit of info on this topic...
    It looks to me like the formatting of the polls is in the poll module (/modules/poll/poll.pages.inc) in the function poll_page():

    PHP Code:
    $output '<ul>';
      foreach (
    $queried_nodes as $node) {
        
    $output .= '<li>' l($node->title"node/$node->nid") . ' - ' format_plural($node->votes'1 vote''@count votes') . ' - ' . ($node->active t('open') : t('closed')) . '</li>';
      }
      
    $output .= '</ul>'
    So if I were interested in modifying the markup in the link I would override the function poll_page() with my own themename_poll_page() function in template.php and change the way it outputs the markup.

    * It might be that your theme is already doing that (causing the weird output) if you built your theme based on another like Zen or something.
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  13. #13
    SitePoint Zealot
    Join Date
    Sep 2009
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, awasson.

  14. #14
    SitePoint Zealot bronze trophy
    Join Date
    Jan 2012
    Posts
    116
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by awasson View Post
    * It might be that your theme is already doing that (causing the weird output) if you built your theme based on another like Zen or something.
    Good call. That would also be my guess.

  15. #15
    SitePoint Zealot
    Join Date
    Sep 2009
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, you'd guess wrong then.

  16. #16
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,021
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mat30 View Post
    Well, you'd guess wrong then.
    So have you figured out where the markup is breaking out of an unordered list?
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  17. #17
    SitePoint Zealot bronze trophy
    Join Date
    Jan 2012
    Posts
    116
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by awasson View Post
    So have you figured out where the markup is breaking out of an unordered list?
    Yea, I'd like to know, too.

    Unless he has a "bootleg copy" of Drupal 7. I'm at a loss.

    The only other thing I can think of is that there would be a conflict with the javascript in one of his plugins that's manipulating his unordered lists -- but that wouldn't show if he's doing "view>source." But either way, it doesn't appear to be a problem with core. He would have had an answer by now if his attitude was a little more humble and gracious. He acts like he's talking with customer support for a product he purchased and he's demanding answers. I don't think he gets yet how open source works.

  18. #18
    SitePoint Zealot
    Join Date
    Sep 2009
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or, perhaps I just object to obnoxious respondents who fail adequately to read the posted questions, try to bluff around the fact that they are unable to answer those questions, by sarcastically telling them to use CSS to solve a template problem, and subsequently post insults like you just did.

  19. #19
    SitePoint Zealot bronze trophy
    Join Date
    Jan 2012
    Posts
    116
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mat30 View Post
    Or, perhaps I just object to obnoxious respondents who fail adequately to read the posted questions, try to bluff around the fact that they are unable to answer those questions, by sarcastically telling them to use CSS to solve a template problem, and subsequently post insults like you just did.
    You're not exactly doing anything to disprove my point. You'll get more bees with honey Mat30, but you'll figure that out soon enough without my lecturing you on it. Good luck on your site.

  20. #20
    SitePoint Addict
    Join Date
    Mar 2010
    Location
    UK
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    CMS "dude", I would not normally comment upon other people's styles, but I think that you have been completely unhelpful here. I was following this thread to see if it had any useful advice (I've just built my site with Drupal, and this theme/template thing is not easy to grasp), but all that you have done is tell this person to use CSS to fix things that even I know can't be fixed with CSS and then belittle him/her for calling you on it. You should be more polite and constructive.

    Mat30: the template system is not easy to use, I know (and I've had to ask quite a few questions about it here). The only advice that I can give is that you can copy any of the functions that are in the included files and put them in a modified form in the template.php file to over-ride them.

  21. #21
    SitePoint Zealot bronze trophy
    Join Date
    Jan 2012
    Posts
    116
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by adh32 View Post
    CMS "dude", I would not normally comment upon other people's styles, but I think that you have been completely unhelpful here. I was following this thread to see if it had any useful advice (I've just built my site with Drupal, and this theme/template thing is not easy to grasp), but all that you have done is tell this person to use CSS to fix things that even I know can't be fixed with CSS ....
    Well, since we're talking about manners, being polite and constructive, might I suggest the following reply, then:

    "Thank you for your reply, CMS Dude, but unfortunately I've ruled that one out, and this doesn't appear to be a CSS issue."

    Would that have been so difficult?

    Look, I don't mean to lecture some of you guys like your Moms or bully you around like your older brothers ... but if there's one piece of advice I could give to you ... that is to be gracious and thankful for a reply, regardless of your perceived value of the reply. You will get a lot more help from people that way -- always. Ultimately, you will seek out answers in your own way, and hopefully you will be successful with it. But seeing as how it's been about 3 days since this question was asked, and still no definitive answer .... I'm guessing there's probably a better way of asking for help. Good luck on your sites, guys!

  22. #22
    SitePoint Addict
    Join Date
    Mar 2010
    Location
    UK
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not surprised that Mat30 hasn't responded to you. I'm not sure that I would, either, to be honest. People come here for help and advice with a tricky topic: proper, constructive help and advice, not sarcasm and little green faces.

  23. #23
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,021
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I think I'll jump in here for a minute....

    I think it's difficult to gauge the intent or emotion from written words on the screen and I think that's why sometimes things can get a little heated on help forums. I'll add that although I don't know CMS Dude, I think he's been very helpful and knowledgeable in many posts I've seen. If I were to take a guess, I would guess he was maybe trying to add some levity to the topic seeing as Mat30 was a bit inflamed in his initial posting trashing the core developers at Drupal for something clearly beyond their influence.

    Maybe his post (Sounds like it's time for someone to start flexing some CSS muscle) was a bit cheeky but if Mat30 came back with something like "thanks but that isn't the issue... The markup is coming out broken, etc..." then they could have moved on and found the solution. Yeah, it gets frustrating working with one of these massive CMS systems when you first get started but if CMS Dude hadn't answered the initial call for help and I hadn't happened by, I'm not sure if the post would have been answered at all.

    Aside from that, I'm curious about whether Mat30 found a solution to the problem
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  24. #24
    SitePoint Zealot bronze trophy
    Join Date
    Jan 2012
    Posts
    116
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by awasson View Post
    If I were to take a guess, I would guess he was maybe trying to add some levity to the topic seeing as Mat30 was a bit inflamed in his initial posting trashing the core developers at Drupal for something clearly beyond their influence.
    Absolutely. A really quick way to turn me off ... is to flame a bunch of programmers who are donating their time ... to provide a very complex and feature-rich Content Management System -- completely free of charge. If it were a commercial program and we were paying what it is truly worth, it would be several thousand dollars, easily.

    Now, I get frustrated with Drupal just like anyone else. Sometimes I want to curse and call the whole lot of 'em a bunch of idiots ... and if you just need to vent, then there are other avenues and/or threads you could start to let those things off your chest. I totally get that. But in a forum like this ... I just think we all need to be coming from a place where we're showing the utmost respect to those who are donating countless hour of their time ... so that we can have something we might not otherwise have access to.

    But to complain about ... yet another guy on a message board who is donating his time to offer free "user support" for said free product. Just because he doesn't particularly like his writing style. To me, it just wreaks of looking multiple gift horses in the mouth, and I think it is in all of our best interest who use open-source product ... to bow down in ultimate respect to those who offer their time for free.

    That's all I'm getting at, and I'm off my soap box ... end of crazed rant.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •