<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Shai</span></b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><br>
thanks a lot for your input, it was <u>VERY</u> helpful!&nbsp; after some
messing about with it, here&#8217;s what seems to work when I have the &#8220;PHP
Mode&#8221; checked in &#8220;Page specific visibility settings&#8221; for configuring
the block:<br>
<br>
<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><br>
&lt;?php<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>// makes block appear if content type = blog<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>if ((arg(0) == 'node') &amp;&amp; is_numeric(arg(1)) &amp;&amp;
!(arg(2))) {<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp; $thenode = node_load(arg(1));<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp; if ($thenode-&gt;type == 'blog') {<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp;&nbsp;&nbsp; return TRUE;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>&nbsp; }<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>//makes block appear if &quot;blog&quot; is in the URL<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>$url = request_uri();<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>if (strpos($url, &quot;blog&quot;)) {<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>return TRUE;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>}<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>?&gt;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'>----<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif"'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><b><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#404040'>brendan, fresh-off.com<o:p></o:p></span></b></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#404040'>Creative Direction &amp; Consultation: Web | Print | Brand<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#404040'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#404040'><a href="http://fresh-off.com">http://fresh-off.com</a><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#404040'><a href="mailto:hello@fresh-off.com">hello@fresh-off.com</a><o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#404040'>206.328.1067<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
support-bounces@drupal.org [mailto:support-bounces@drupal.org] <b>On Behalf Of </b>Shai
Gluskin<br>
<b>Sent:</b> Monday, November 09, 2009 8:53 AM<br>
<b>To:</b> support@drupal.org<br>
<b>Subject:</b> Re: [support] getting block to show up for specific pages and
specific node type<o:p></o:p></span></p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>He Brendan,<br>
<br>
You are on the right track. You just have to add some more php to do another
test. A slight change in the structure is that you need to make a variable for
the display status and then return it only at the end of the whole snippet.
When there is only one test, you can just set the status &quot;True&quot; or
&quot;False&quot; directly with a return statement that is in the chunk of code
as the test itself (that was how your original snippet did it).<br>
<br>
Note that I did NOT test the code, so there definitely could be a type in there.<br>
<br>
I posted it to a pastebin: <a href="http://pastebin.ca/1663597">http://pastebin.ca/1663597</a><br>
<br>
Shai<o:p></o:p></p>

<div>

<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;
margin-left:4.8pt;margin-right:0in'>

<div>

<div>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b>Hello,
</b><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>I
found a code snippet on <a href="http://drupal.org" target="_blank">drupal.org</a>
that allows a block to be shown only on specific node types when 'Show if the
following PHP code returns TRUE' is checked on the Configure Blocks page:<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>-----<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000BB'>&lt;?php<br>
</span><span style='font-size:10.0pt;font-family:"Courier New";color:#007700'>if
((</span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000BB'>arg</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#007700'>(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000BB'>0</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#007700'>) == </span><span
style='font-size:10.0pt;font-family:"Courier New";color:#DD0000'>'node'</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#007700'>) &amp;&amp; </span><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000BB'>is_numeric</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#007700'>(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000BB'>arg</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#007700'>(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000BB'>1</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#007700'>)) &amp;&amp;
!(</span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000BB'>arg</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#007700'>(</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#0000BB'>2</span><span
style='font-size:10.0pt;font-family:"Courier New";color:#007700'>))) {<br>
&nbsp; </span><span style='font-size:10.0pt;font-family:"Courier New";
color:#0000BB'>$thenode </span><span style='font-size:10.0pt;font-family:"Courier New";
color:#007700'>= </span><span style='font-size:10.0pt;font-family:"Courier New";
color:#0000BB'>node_load</span><span style='font-size:10.0pt;font-family:"Courier New";
color:#007700'>(</span><span style='font-size:10.0pt;font-family:"Courier New";
color:#0000BB'>arg</span><span style='font-size:10.0pt;font-family:"Courier New";
color:#007700'>(</span><span style='font-size:10.0pt;font-family:"Courier New";
color:#0000BB'>1</span><span style='font-size:10.0pt;font-family:"Courier New";
color:#007700'>));&#8217;<br>
&nbsp; if (</span><span style='font-size:10.0pt;font-family:"Courier New";
color:#0000BB'>$thenode</span><span style='font-size:10.0pt;font-family:"Courier New";
color:#007700'>-&gt;</span><span style='font-size:10.0pt;font-family:"Courier New";
color:#0000BB'>type </span><span style='font-size:10.0pt;font-family:"Courier New";
color:#007700'>== </span><span style='font-size:10.0pt;font-family:"Courier New";
color:#DD0000'>'blog'</span><span style='font-size:10.0pt;font-family:"Courier New";
color:#007700'>) {<br>
&nbsp;&nbsp;&nbsp; return </span><span style='font-size:10.0pt;font-family:
"Courier New";color:#0000BB'>TRUE</span><span style='font-size:10.0pt;
font-family:"Courier New";color:#007700'>;<br>
&nbsp; }<br>
}<br>
</span><span style='font-size:10.0pt;font-family:"Courier New";color:#0000BB'>?&gt;</span><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>-----<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;margin-bottom:12.0pt'><br>
this works great, except for that I&#8217;d like the block to show for nodes of
type &#8220;blog&#8221; <b><u>AND</u></b> also on specific pages &#8211; in my
case <a href="http://www.mysite.com/blog" target="_blank">www.mysite.com/blog</a>
which is a view showing a list of blogs.&nbsp; How can I do both? <o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><br>
----<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span
style='color:#404040'>brendan, <a href="http://fresh-off.com" target="_blank">fresh-off.com</a></span></b><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='color:#404040'>Creative Direction &amp; Consultation: Web | Print |
Brand</span><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='color:#404040'>&nbsp;</span><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='color:#404040'><a href="http://fresh-off.com" target="_blank">http://fresh-off.com</a></span><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='color:#404040'><a href="mailto:hello@fresh-off.com" target="_blank">hello@fresh-off.com</a></span><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span
style='color:#404040'>206.328.1067</span><o:p></o:p></p>

<p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>&nbsp;<o:p></o:p></p>

</div>

</div>

<p class=MsoNormal><br>
--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a>
]<o:p></o:p></p>

</blockquote>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>