# \[Pro\] Problem with Perch and Crowbar?

**URL:** <https://discourse.softpress.com/t/pro-problem-with-perch-and-crowbar/19564>\
**Category:** Off Topic\
**Created:** [February 5, 2014, 10:47pm UTC](https://discourse.softpress.com/t/pro-problem-with-perch-and-crowbar/19564 "2014-02-05T22:47:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![RavenManiac](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@RavenManiac](https://discourse.softpress.com/u/RavenManiac)\
**Post date:** [February 5, 2014, 10:47pm UTC](https://discourse.softpress.com/t/pro-problem-with-perch-and-crowbar/19564/1 "2014-02-05T22:47:03Z")

</div>

I’m having some trouble getting Crowbar to accept some PHP code I’m using to insert Perch content into a page. The error message I’m getting is, “A surrounding tag could not be detected. Your code was not added to the page.”

Here’s the code:

```auto
<?php perch_content_custom('Image', array(
	'page'=>'//index.php'
)); ?>

```

And here are the instructions:

> **[perch\_content\_custom()](http://docs.grabaperch.com/functions/content/perch-content-custom/)**
>
> Perch documentation

What am I doing wrong?

* * *

offtopic mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![waltd](https://discourse.softpress.com/user_avatar/discourse.softpress.com/waltd/32/2720_2.png) [@waltd](https://discourse.softpress.com/u/waltd)\
**Post date:** [February 5, 2014, 11:26pm UTC](https://discourse.softpress.com/t/pro-problem-with-perch-and-crowbar/19564/2 "2014-02-05T23:26:15Z")

</div>

Crowbar will only throw that error if it cannot find the surrounding tag to apply the code to. Can you say a little more about how you are applying it? Is it inline within an HTML box? Crowbar is entirely agnostic about the code you insert – it genuinely doesn’t care about that. The issue is your page construction and where you’ve inserted the Action-item.

Walter

On Feb 5, 2014, at 5:47 PM, RavenManiac wrote:

> I’m having some trouble getting Crowbar to accept some PHP code I’m using to insert Perch content into a page. The error message I’m getting is, “A surrounding tag could not be detected. Your code was not added to the page.”
> 
> Here’s the code:
> 
> ```auto
> <?php perch_content_custom('Image', array(
> 'page'=>'//index.php'
> )); ?>
> 
> ```
> 
> And here are the instructions:  
> [perch\_content\_custom() - Perch CMS documentation](http://docs.grabaperch.com/docs/content/perch-content-custom/)
> 
> What am I doing wrong?
> 
> * * *
> 
> offtopic mailing list  
> email@hidden  
> Update your subscriptions at:  
> [http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

* * *

offtopic mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![RavenManiac](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@RavenManiac](https://discourse.softpress.com/u/RavenManiac)\
**Post date:** [February 6, 2014, 12:48am UTC](https://discourse.softpress.com/t/pro-problem-with-perch-and-crowbar/19564/3 "2014-02-06T00:48:41Z")

</div>

I’ve placed the Crowbar code inside an HTML item. Looking at the code, it appears that Perch is trying to insert it into a table, which strikes me as very odd. Here’s the code.

```auto
			<div id="item1"><table style="border-spacing:0px; width:101px; table-layout:fixed">
					<colgroup>
						<col style="width:100px">
						<col style="width:1px">
					</colgroup>
					<tr style="vertical-align:top">
						<td>&perch-image;</td>
						<td></td>
					</tr>
					<tr class="f-sp">
						<td><img src="../Resources/_clear.gif" width=100 height=1 alt="" style="float:left"></td>
						<td style="height:1px"><img src="../Resources/_clear.gif" width=1 height=1 alt="" style="float:left"></td>
					</tr>
				</table>
			</div>

```

* * *

offtopic mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![waltd](https://discourse.softpress.com/user_avatar/discourse.softpress.com/waltd/32/2720_2.png) [@waltd](https://discourse.softpress.com/u/waltd)\
**Post date:** [February 6, 2014, 1:06am UTC](https://discourse.softpress.com/t/pro-problem-with-perch-and-crowbar/19564/4 "2014-02-06T01:06:22Z")

</div>

Is that HTML item a blue-border table layout element, or a green-border DIV? Check in the Inspector to see if Layer or CSS (if it’s inline) is checked. Also look in the style tab to see if you’ve added a graphic background or curved corners to the box. Those come with tables that you wouldn’t expect, too.

Walter

On Feb 5, 2014, at 7:48 PM, RavenManiac wrote:

> I’ve placed the Crowbar code inside an HTML item. Looking at the code, it appears that Perch is trying to insert it into a table, which strikes me as very odd. Here’s the code.
> 
> ```auto
> <div id="item1"><table style="border-spacing:0px; width:101px; table-layout:fixed">
> <colgroup>
> <col style="width:100px">
> <col style="width:1px">
> </colgroup>
> <tr style="vertical-align:top">
> <td>&perch-image;</td>
> <td></td>
> </tr>
> <tr class="f-sp">
> <td><img src="../Resources/_clear.gif" width=100 height=1 alt="" style="float:left"></td>
> <td style="height:1px"><img src="../Resources/_clear.gif" width=1 height=1 alt="" style="float:left"></td>
> </tr>
> </table>
> </div>
> 
> ```
> 
> * * *
> 
> offtopic mailing list  
> email@hidden  
> Update your subscriptions at:  
> [http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

* * *

offtopic mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![RavenManiac](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/r/91b2a8/32.png) [@RavenManiac](https://discourse.softpress.com/u/RavenManiac)\
**Post date:** [February 6, 2014, 1:15am UTC](https://discourse.softpress.com/t/pro-problem-with-perch-and-crowbar/19564/5 "2014-02-06T01:15:10Z")

</div>

Walter, it was a user error—as usual.

I’m still getting used to where Perch puts things. Sometimes you have to specify a directory, other times you don’t. All is good. I’ll post a link as soon as I get everything straightened out. Thanks for your help.

K

* * *

offtopic mailing list  
email@hidden  
Update your subscriptions at:  
[http://freewaytalk.net/person/options](http://freewaytalk.net/person/options)
