Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2013-01-23 08:23:17

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: New to TXP 4.54 - Making a Frontpage

You’ve got a type in there:

<txp:article limit=1" status="sticky" />

Should be:

<txp:article limit="1" status="sticky" />

I’ve pasted the functionality you require into the original Textpattern default page like so (around line 109):

<!DOCTYPE html>
<html lang="<txp:lang />">

<head>
  <meta charset="utf-8">

<!-- page title and metas, no meta keywords as they are now obsolete -->
  <title><txp:page_title /></title>
  <meta name="description" content="">
  <meta name="generator" content="Textpattern CMS">
  <txp:if_search>
    <meta name="robots" content="none">
  <txp:else />
  <txp:if_category>
    <meta name="robots" content="noindex, follow, noodp, noydir">
  <txp:else />
  <txp:if_author>
    <meta name="robots" content="noindex, follow, noodp, noydir">
  <txp:else />
    <meta name="robots" content="index, follow, noodp, noydir">
  </txp:if_author>
  </txp:if_category>
  </txp:if_search>

<!-- mobile viewport optimised, more info: http://h5bp.com/viewport -->
  <meta name="viewport" content="width=device-width, initial-scale=1">

<!-- content feeds -->
  <txp:feed_link flavor="atom" format="link" label="Atom" />
  <txp:feed_link flavor="rss" format="link" label="RSS" />
  <txp:rsd />

<!-- specify canonical, more info: http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html -->
  <txp:if_section name="">
    <link rel="canonical" href="<txp:site_url />">
  <txp:else />
    <txp:if_individual_article>
      <link rel="canonical" href="<txp:permlink />">
    <txp:else />
      <link rel="canonical" href="<txp:section url='1' />">
    </txp:if_individual_article>
  </txp:if_section>

<!-- css -->
  <!-- Google font API (remove this if you intend to use the theme in a project without internet access) -->
  <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Serif:n4,i4,n7,i7|Cousine">

  <txp:css format="link" media="" />
  <!-- or you can use (faster) external CSS files eg. <link rel="stylesheet" href="<txp:site_url />css/default.css"> -->

<!-- HTML5/Media Queries support for IE < 9 (you can remove this section and the corresponding 'js' directory files if you don't intend to support IE < 9) -->
  <!--[if lt IE 9]>
    <script src="<txp:site_url />js/html5shiv.js"></script>
    <script src="<txp:site_url />js/css3-mediaqueries.js"></script>
  <![endif]-->

</head>

<body id="<txp:if_section name=""><txp:if_search>search<txp:else />front</txp:if_search><txp:else /><txp:section /></txp:if_section>-page">

<!-- header -->
  <header role="banner">
    <hgroup>
      <h1><txp:link_to_home><txp:site_name /></txp:link_to_home></h1>
      <h3><txp:site_slogan /></h3>
    </hgroup>
  </header>

<!-- navigation -->
  <nav role="navigation">
    <h1><txp:text item="navigation" /></h1>
    <txp:section_list default_title='<txp:text item="home" />' include_default="1" wraptag="ul" break="">
      <li<txp:if_section name='<txp:section />'><txp:if_search><txp:else /><txp:if_category><txp:else /><txp:if_author><txp:else /> class="active"</txp:if_author></txp:if_category></txp:if_search></txp:if_section>>
        <txp:section title="1" link="1" />
      </li>
    </txp:section_list>
  </nav>

  <div class="wrapper">
    <div class="container">

<!-- left (main) column -->
      <div role="main">

      <!-- is this result result page? also omits the pagination links below (uses pagination format within search_results.article.txp instead) -->
      <txp:if_search>

        <h1><txp:text item="search_results" /></h1>
        <txp:output_form form="search_results"/>

      <txp:else />

        <!-- else is this an article category list? -->
        <txp:if_category>

          <h1><txp:text item="category" /> <txp:category title="1" /></h1>
          <txp:article form="article_listing" limit="5" />

        <txp:else />

          <!-- else is this an article author list? -->
          <txp:if_author>

          <h1><txp:text item="author" /> <txp:author /></h1>
          <txp:article form="article_listing" limit="5" />

          <txp:else />

          <!— Homepage Intro — >
          <txp:article limit="1" status="sticky" />

          <!— News-flash —>
          <txp:article_custom section="articles" sort="posted desc" limit="3" form="article_listing" />

          </txp:if_author>
        </txp:if_category>

        <!-- add pagination links to foot of article/article listings/category listings if there are more articles available,
          this method is more flexibile than using simple txp:link_to_prev/txp:link_to_next or txp:older/txp:newer tags -->
        <p id="paginator">

        <txp:variable name="prev" value='<txp:older />' />
        <txp:variable name="next" value='<txp:newer />' />

        <txp:if_variable name="prev" value="">
          <span id="paginator-l" class="button disabled">← <txp:text item="older" /></span>
        <txp:else />
          <a id="paginator-l" href="<txp:older />" title="<txp:text item='older' />" class="button">← <txp:text item="older" /></a>
        </txp:if_variable>
        <txp:if_variable name="next" value="">
          <span id="paginator-r" class="button disabled"><txp:text item="newer" /> →</span>
        <txp:else />
            <a id="paginator-r" href="<txp:newer />" title="<txp:text item='newer' />" class="button"><txp:text item="newer" /> →</a>
        </txp:if_variable>

        </p>

      </txp:if_search>

      </div> <!-- /main -->

<!-- right (complementary) column -->
      <div role="complementary">
        <txp:search_input /> <!-- links by default to form: 'search_input.misc.txp' unless you specify a different form -->

        <!-- Feed links, default flavor is rss, so we don't need to specify a flavor on the first feed_link -->
        <p><txp:feed_link label="RSS" class="feed-rss" /> / <txp:feed_link flavor="atom" label="Atom" class="feed-atom" /></p>

        <h4><txp:text item="external_links" /></h4>
        <txp:linklist wraptag="ul" break="li" limit="10" /> <!-- links by default to form: 'plainlinks.link.txp' unless you specify a different form -->
      </div> <!-- /complementary -->

    </div> <!-- /.container -->
  </div> <!-- /.wrapper -->

<!-- footer -->
  <footer role="contentinfo">
    <p><small><txp:text item="published_with" /> <a href="http://textpattern.com" rel="external" title="<txp:text item='go_txp_com' />">Textpattern CMS</a>.</small></p>
  </footer>

<!-- JavaScript at the bottom for fast page loading, more info: http://developer.yahoo.com/performance/rules.html#js_bottom -->

  <!-- add your own JavaScript here -->

</body>
</html>

On a separate note, that page might look a little long and convoluted but once you start stripping out things like the header/footer into reusable misc form snippets then the whole thing looks a lot more manageable.

Bring those snippets in using, for example:

<txp:output_form form="header" />

Also bear in mind that the ‘default’ section in Textpattern is also used for search, category lists and author lists. So that logic is also in the page code above. If you don’t intend on using those features in your site you can get rid of conditionals such as <txp:if_search> and <txp:if_author>.

Offline

#14 2013-01-23 22:41:20

madzzoni
Member
From: Grünberg/Hessen/DE
Registered: 2013-01-22
Posts: 38

Re: New to TXP 4.54 - Making a Frontpage

Arghh philwareham, – I didn’t see the missing “ in the code either, just copy/pasted.. mmm ;-/ … But, that’s helps!!!
Now i think i begin to understand the TXP logic ;-) … and i only want to change the Form for the “homepage”, but i think it’s just to ad a new form to the TXP tag:

<txp:article limit="1" status="sticky" form="intro_homepage" /> 

Thanks again!


<TXP:n00b />

Offline

#15 2013-01-26 00:20:24

madzzoni
Member
From: Grünberg/Hessen/DE
Registered: 2013-01-22
Posts: 38

Re: New to TXP 4.54 - Making a Frontpage

Hello there.

Now i got a problem with the Search-form, It doesn’t show any results, just stay on the “Homepage”!

Here is my search_input Form (default):

<form role="search" method="get" action="<txp:site_url />">
  <p><input id="search-textbox" type="search" name="q"<txp:if_search> value="<txp:search_term />"</txp:if_search>><input type="submit" value="<txp:text item='search' />"></p>
</form>

Do i have to change the “<txp:site_url />” or??

My test site: http://fym.xconsult.dk

Best regards,
madzzoni


<TXP:n00b />

Offline

#16 2013-01-26 01:14:44

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,315

Re: New to TXP 4.54 - Making a Frontpage

I’d say it’s the <txp:if_search> tag pair. It’s not needed inside the search form, and can only be used on a results page.

wiki wrote:

The tag will execute the contained statements if the called page is the result of a search.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#17 2013-01-26 01:35:04

madzzoni
Member
From: Grünberg/Hessen/DE
Registered: 2013-01-22
Posts: 38

Re: New to TXP 4.54 - Making a Frontpage

… I removed the <txp:if_search> tag pair, but it doesn’t help ;-/

<form role="search" method="get" action="<txp:site_url />">
  <p><input id="search-textbox" type="search" name="q" value="<txp:search_term />"><input type="submit" value="<txp:text item='search' />"></p>
</form>

I used this code from the TXP Docs:
http://www.textpattern.net/wiki/index.php?title=Default_Forms#search_input

But thx.


<TXP:n00b />

Offline

#18 2013-01-26 09:28:10

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: New to TXP 4.54 - Making a Frontpage

Can you post the complete page template that contains your search stuff and we’ll take a look.

Offline

#19 2013-01-27 02:52:52

madzzoni
Member
From: Grünberg/Hessen/DE
Registered: 2013-01-22
Posts: 38

Re: New to TXP 4.54 - Making a Frontpage

Thanks Phil. but i fixed the problem, and end up using the default form: “search_input” as is ;-)

I’ve added the Search-part-tags from the default-page to my new default “Homepage” like this:

<!-- is this result result page? also omits the pagination links below (uses pagination format within search_results.article.txp instead) -->
      <txp:if_search>
      <h1><txp:text item="search_results" /></h1>
        <txp:output_form form="search_results"/>
       <txp:else />
<!-- Homepage Intro -- >
        <txp:article limit="1" status="sticky" form="intro_homepage" />
  <!-- News-flash -->  
      <txp:article_custom section="article" class="newsflash" sort="posted desc" limit="3" form="static_headline" wraptag="ul" break="li" pgonly="0" />
     </txp:if_search>

I also learned already, that if you work with TXP in other language (like da_DK), DON’T change the original Sections-names, only the titles, if U don’t want a lot of work. ;-)

Best regards!


<TXP:n00b />

Offline

#20 2013-03-04 09:16:36

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Re: New to TXP 4.54 - Making a Frontpage

Dragondz wrote:

Like noted by phil above only add a code like that:

[…]

I tried the solutions presented here and pulling last 3 articles from the selected categories and display excerpts on the ‘homepage’ using ‘read more’ link.

Everything works except that when I click on the Category list on the right sidebar, it does not show any article?

Let me say that each article belongs to only one category, and I use /section/title schema.

I’ve also noticed that newer/older breadcrumb links do not work and just redisplay the same page, so I thought it must be some cleanURLS-related problem ‘cause I use Hiawatha webserver which runs behind Nginx reverse-proxy, but even after switching (temporarily) to Apache2, I had the same problem and now trying the same thing on my localhost (using direct Hiawatha server), I see that both category listing as well as breadcrumb links work on ‘default’ site with several dumb articles which means that I did some mistake in my tweaking of the site based on the above hints?

Any idea what do I miss to have category-listing and/or breadcrumb links not working?

Now I see that the problem is only that clicking on some category like e.g. novosti shows nothing?

I’d like to provide URL for my testing site, but atm, the host seems to have such DNS problems…

Here it is…

Last edited by gour (2013-03-04 10:08:34)

Offline

#21 2013-03-04 10:35:00

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,547
Website GitHub Twitter

Re: New to TXP 4.54 - Making a Frontpage

Hi gour

can you post the code of your page or the form that you use in the website? i suspect that there is a txp:if_undividual_article or txp:if_article_list issue!

Sorry i havent read the previous messages!!

maybe add status=“sticky” in the txp:article_custom would solve the problem.

Last edited by Dragondz (2013-03-04 10:38:19)

Offline

#22 2013-03-04 10:51:17

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Re: New to TXP 4.54 - Making a Frontpage

Dragondz wrote:

Sorry i havent read the previous messages!!

OK. Here is the diff between my ‘default’ and ‘‘homepage’ pages?

Do I miss something here?

maybe add status=“sticky” in the txp:article_custom would solve the problem.

I tried to add it in my ‘homepage page, but then I do not get anything ‘cause none of my articles are set to ‘sticky’ — I just want to pull the 3 newest ones to the homepage, but even setting those articles as sticky does not change anything.

Any further idea?

Offline

#23 2013-03-04 11:29:56

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,547
Website GitHub Twitter

Re: New to TXP 4.54 - Making a Frontpage

hi

can you show the enitire template, the code shown on the link begin with <txp:else />!

Offline

#24 2013-03-04 11:39:04

gour
Member
From: Hlapičina, Croatia
Registered: 2013-01-17
Posts: 124

Re: New to TXP 4.54 - Making a Frontpage

Dragondz wrote:

can you show the enitire template, the code shown on the link begin with <txp:else />!

Here it is:

Do I need to show something else?

Offline

Board footer

Powered by FluxBB