Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-04-03 01:09:36

wolfcry911
Member
From: MA, USA
Registered: 2006-06-30
Posts: 51

[SOLVED]Possible to select a specific article page in misc form?

I have a misc form outputting the head of my document. I want to include javascript for a single article (which is in a section with other articles associated to it) in this form. Is it possible? I know I can add the javascript for the entire section using txp:if_section, and I also know that txp:if_article_id (and probably all the if_article tags) will not work outside of the article form context (this is misc). Is there a way to accomplish this?

Last edited by wolfcry911 (2011-04-12 13:09:13)

Offline

#2 2011-04-03 01:23:24

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,257
Website GitHub Mastodon Twitter

Re: [SOLVED]Possible to select a specific article page in misc form?

Hi Christopher

For me, the if_article_id works just fine in the head. Did you try it?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2011-04-03 01:59:29

wolfcry911
Member
From: MA, USA
Registered: 2006-06-30
Posts: 51

Re: [SOLVED]Possible to select a specific article page in misc form?

Thanks for your response colak,

yes, I did try it. It doesn’t work in a misc form. If I had an article form output the document head, it would work, but that’s not how ‘built’ this site… :(

Offline

#4 2011-04-03 02:28:08

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: [SOLVED]Possible to select a specific article page in misc form?

The name “misc” is used only for your internal organization, it has no effect on the function.

Offline

#5 2011-04-03 02:44:57

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,257
Website GitHub Mastodon Twitter

Re: [SOLVED]Possible to select a specific article page in misc form?

can you post your head code?

Edit: It shouldn’t be needed but what if you add something like

<txp:if_individual_article>
<txp:if_article_id id="3,56,59">
<script type="text/javascript" src="/js/your.js"></script>
</txp:if_article_id>
</txp:if_individual_article>

Last edited by colak (2011-04-03 02:49:10)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#6 2011-04-03 02:50:49

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,257
Website GitHub Mastodon Twitter

Re: [SOLVED]Possible to select a specific article page in misc form?

GugUser wrote:

The name “misc” is used only for your internal organization, it has no effect on the function.

Also only forms saved as article forms appear in the write tab


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#7 2011-04-03 03:32:08

wolfcry911
Member
From: MA, USA
Registered: 2006-06-30
Posts: 51

Re: [SOLVED]Possible to select a specific article page in misc form?

GugUser – ahh, I see now, but the form is not being called under an article context
colak, I’ll try to post some code here

Here is the page under the section in question (simple enough):

<txp:output_form form="meta_header" />
<txp:output_form form="sidebar" />

  <div id="content" <txp:if_article_list>class="list"</txp:if_article_list>>

    <txp:article status="sticky" form="static_text" />
    <txp:if_individual_article>
      <txp:article form="static_text" />
    <txp:else />
      <txp:article limit="4" form="contact_text" sort="ID" />
      <txp:article offset="4" form="contact_short" sort="ID" />
    </txp:if_individual_article>
  </div>

<txp:output_form form="footer" />

And the first misc form called – meta_header (simplified):

<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
  <meta charset="utf-8">

  <title><txp:page_title separator=" | " /></title>

  <meta name="description" content="">
  <meta name="author" content="">

  <link rel="home" href="<txp:site_url />">
  <link rel="stylesheet" href="/css/style.css">

  <script src="/js/libs/modernizr-1.6.min.js"></script>
  <txp:if_section name="contact"><txp:output_form form="map" />
</txp:if_section>

</head>

<body id="<txp:if_section name="">front<txp:else /><txp:section /></txp:if_section>" >

<div id="container">

  <header>
    <h1 id="site-name"><txp:link_to_home><txp:site_name /></txp:link_to_home></h1>
    <p id="site-slogan"><txp:site_slogan /></p>
    <nav>
      <txp:cbs_navigation_menu />
    </nav>
    <txp:search_input wraptag="label" label="Search" size="20" />

  </header>

It’s in this form that I’m trying to include javascript for a single page. Currently, it’s being called for the entire section using the if_section tag and outputting the form containing the javascript (map).

Last edited by wolfcry911 (2011-04-03 03:38:12)

Offline

#8 2011-04-03 04:11:29

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: [SOLVED]Possible to select a specific article page in misc form?

wolfcry911 schrieb:

(…) but the form is not being called under an article context.

What do you mean with “article context”?

Offline

#9 2011-04-03 05:28:09

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,257
Website GitHub Mastodon Twitter

Re: [SOLVED]Possible to select a specific article page in misc form?

I guess there is one question which might not be relevant but it is worth a try.

What url mode are you using? I found that if_article_id does not always work when /section/title is used.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#10 2011-04-03 11:27:25

wolfcry911
Member
From: MA, USA
Registered: 2006-06-30
Posts: 51

Re: [SOLVED]Possible to select a specific article page in misc form?

GugUser, I mean that there’s no article tag calling the form – its just a form output from the section page

colak, I am in fact using the /section/title url mode. Am I to understand this may have worked with a different mode (not that I’m going to change it, but I’m curious)?

Do I have any other options?

Last edited by wolfcry911 (2011-04-03 11:29:11)

Offline

#11 2011-04-03 14:23:22

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,257
Website GitHub Mastodon Twitter

Re: [SOLVED]Possible to select a specific article page in misc form?

wolfcry911 wrote:

I am in fact using the /section/title url mode. Am I to understand this may have worked with a different mode (not that I’m going to change it, but I’m curious)?

  1. Why don’t you temporarily change it to id/title
  2. add <txp:if_article_id id="your_article_id"><txp:output_form form="map" /></txp:if_article_id> where you want
  3. test it. If you do get the map let us know and we’ll figure something out

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#12 2011-04-03 16:04:27

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: [SOLVED]Possible to select a specific article page in misc form?

In my experiment in the /section/title url mode the following works when the article with ID 63 is showing:

<head>
	(…)
	<txp:if_article_id id="63">something</txp:if_article_id>
</head>

Last edited by GugUser (2011-04-03 16:05:17)

Offline

Board footer

Powered by FluxBB