Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2020-07-29 19:26:21

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,892
Website

Re: Comment Modules

afoster wrote #324954:

First question… Second question…

Sorry, I didn’t notice your edits. If you post a fresh forum comment, the thread shows up as being updated.

in looking at the screenshots you provided, how/where would I place the image at the top of the homepage. I have an image that fits the size needed but have not been able to get it to display. For that matter, I have not been able to display the homepage.

I followed the tutorial :-) The homepage template is described under “Set up your page templates”. You just need to assign the correct page template:

  • Visit Admin › Presentation › Sections
  • Click on default and set the page template to Home.
  • Click Save.

And under “Bring it all home” in the tutorial it says: “You will notice in the “home” page template, that there is this tag: <txp:image id=”3″ />. Replace this number with the # of the image you want to appear here …”

  • Visit Content › Images and note the id number of the image you want to use.
  • Visit Admin › Presentation › Pages.
  • Click on home.
  • Find <txp:image id="3" /> and replace 3 with the image number you noted. It has to be 940px wide by 350px high.

That’s not really an ideal way of doing it, but I didn’t change the template more than necessary so that it still roughly corresponds to the tutorial. It’s really written to help you get the idea of how things hang together.

Second question…I have been able to remove the webpage information from the contact form. I would like the Name and Email labels and text boxes to appear in two columns…can you point me in the right direction for that?

I’m guessing you mean you created an article and assigned to the “contact” section, then added com_connect tags to the body area to produce the contact form.

If you’ve done that, then, like Colak mentioned, you just need to add some html and the appropriate styling to your contact form. Marie writes in the tutorial, she’s using an adapted version of Google Blueprint CSS (rather outdated after 11 years, but I digress) and that has some column styles already in it based on a 24-column grid. I’m not familiar with it, but something like this should work:

<txp:com_connect to="recipient@example.com" label="" wraptag="div" class="container">
    <div class="span-12">
        <txp:com_connect_text label="Name" break="" />
    </div>
    <div class="span-12 last">
        <txp:com_connect_email label="Email" break="" />
    </div>
    <txp:com_connect_textarea label="Message" rows="10" cols="23" break="" />
    <txp:com_connect_submit label="Send" />
</txp:com_connect> 

I’m not on the computer I tested it with at the moment, so I can’t test it. You may need to adjust it accordingly.

A general note:

What I tried to point out earlier, and what bici mentioned, is that the tutorial is good for showing the principle of how pages are put together with Textpattern (I didn’t need to change much at all for it to work after all these years) but it does some things with hard-coding, i.e. the image number or the menu section names. That’s expedient for showing the principle, but not extensible.

CSS has also come a long way since then. You can use CSS grid or flexbox to build page layouts that are much more robust and adapt to changing device widths and you can contain images in boxes so that layouts don’t break if images aren’t precisely sized.

I suggest using the tutorial as inspiration and for understanding how the parts of Textpattern fit together but it’s not such a great basis for a final site.


TXP Builders – finely-crafted code, design and txp

Offline

#32 2020-07-29 20:17:52

afoster
Member
Registered: 2020-07-25
Posts: 11

Re: Comment Modules

Thank you both for your responses to my latest plea for help. In re-reading my message, I noticed that under my “Second Question” I reference the contact form when I really meant to reference the comments form. I have not done anything to the contact form yet, but your post Jakob about that topic should help me. I will try to apply the <DIV></DIV> to the comment form and see if I can move the Name and text area to a second column.

UPDATE: I just realized that even though I have set up to allow comments, there is no way to add a comment on any article, blog entry or work entry. Where did I go wrong this time?

Last edited by afoster (2020-07-29 23:15:56)

Offline

#33 2020-07-30 08:09:39

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,892
Website

Re: Comment Modules

UPDATE: I just realized that even though I have set up to allow comments, there is no way to add a comment on any article, blog entry or work entry. Where did I go wrong this time?

It’s nothing you did :-) The short answer is that Marie’s original template doesn’t include code for comments.

A longer answer in the spirit of helping you find out why: apologies if this is not the most direct path to an answer, but I’ll try and follow through the process of diagnosis as it may help with getting bearings. Let’s look at just the blog articles for the moment:

  • In Admin › Presentation › Sections look at the “blog” section. It should be assigned to the archive page (if you followed Marie’s instructions). If not assign that as the page.
  • So, let’s look at what that shows: In Admin › Presentation › Pages, look at the “archive” page template. If we look in there, we see:
<div class="span-8">
    <txp:article_custom section="blog" form="subnav" sort="posted desc" />
</div>

<div class="span-16 last">
     <txp:article form="single" listform="article_listing" sort="posted desc" limit="1" />
     ...
</div>

The first column (span-8) is an article_custom tag that specifically gets articles from the “blog” section and outputs them using the subnav form. The article_custom does is a specific request that is not context-aware (i.e. pays no regard to what page you might be on).

The second column (span-16) is an article tag that is context aware: on an article_list page it uses the form specified in listform (e.g. article_listing) and on an individual article view, it uses the single form. That’s the case we want.

  • So, in Admin › Presentation › Forms, open the “Article” group on the left-hand side and look at the “single” form template:
<h3><txp:title /></h3>
<txp:body />

That’s very bare bones: just the title and the article body. There’s no mention of comments anywhere there. That’s the reason why none show:💡!

What now? Compare that against the default theme. In the default “four-point-eight” theme, an article is output using the default form of type: article (if you don’t specify a form name the txp:article tag uses “default” as standard). There you’ll see this code (here on GitHub for reference)

<!-- if this is an individual article then add the comments section via form: comments_display.article.txp -->
<txp:if_individual_article>
     <txp:output_form form="comments_display" />
</txp:if_individual_article>

That should be self-explanatory. You’ll find the comments_display under the “comment” group of the forms panel (here on GitHub). That form calls a few other forms in the comment group.

Unfortunately, Marie’s template includes none of that and I didn’t repair the missing holes.

Solution: What you can do here is copy over the form code from the “Four-point-eight” template. You’ll need “comments_display”, “comments” and “comment_form” and you can find them if you switch theme at the top of the “Forms” pane (or here on GitHub if you’ve overwritten yours). Those forms are more involved and more capable than Marie’s original simple template but they also have comments in them to help you understand what’s happening where.

I hope that helps and doesn’t confuse 😳


TXP Builders – finely-crafted code, design and txp

Offline

#34 2020-07-30 12:30:30

etc
Developer
Registered: 2010-11-11
Posts: 3,777
Website

Re: Comment Modules

This makes me think (again) that txp really needs to be furnished with a very basic ‘first steps’ theme. Unfortunately, I have no designer talents..

Offline

#35 2020-07-30 12:35:25

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 3,892
Website

Re: Comment Modules

etc wrote #324999:

This makes me think (again) that txp really needs to be furnished with a very basic ‘first steps’ theme. Unfortunately, I have no designer talents..

It’s already in the works – also with a portfolio as a focus – but I’m just a little overwhelmed with work at the moment.


TXP Builders – finely-crafted code, design and txp

Offline

#36 2020-07-30 12:39:30

etc
Developer
Registered: 2010-11-11
Posts: 3,777
Website

Re: Comment Modules

jakob wrote #325001:

It’s already in the works – also with a portfolio as a focus – but I’m just a little overwhelmed with work at the moment.

Oh, great, thank you! If you can keep it basic (just essential forms/pages/tags) I’m sure it will help with first txp steps.

Offline

#37 2020-07-30 14:52:51

afoster
Member
Registered: 2020-07-25
Posts: 11

Re: Comment Modules

Thanks again Jakob…I will go back and look at everything you have suggested.

Offline

Board footer

Powered by FluxBB