Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
get_component not persisting
#1
Hi,

I created a new component to add a subscribe box to the top right of each page. This is the component include code that the system created:

Code:
<?php get_component('subscribe-sidebar'); ?>

I installed the exec-php plugin. I don't know if it's necessary, but I did in any case. Adding the component brings up the box. So it works fine. The problem is, whenever I enter the page to edit the info again, the component disappears. In fact, the component disappears after being added, when the page is saved. The box shows up on the page, but the code disappears from the editor.

Any thoughts on how to make the code persist? It's not a problem for me to add the component code each time, but it could cause confusion for anyone else updating the page in future (which is what I'm working towards).
Reply
#2
my guess is that the code you are putting in there is messing up the XML file somehow...

When you go to the Components Management screen and it's not there:

1. View source on the page: Do you see the code in there somewhere? If so, can you copy and paste what you see?

2. Check the /data/other/components.xml file to see if the code is in there or not.
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#3
f1gp Wrote:I installed the exec-php plugin. I don't know if it's necessary, but I did in any case.
- it's not necessary for this... components arent touched by this plugin
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#4
Thanks for the reply Chris. Hmmm, apologies. I should have included the code I insert in the component.

It's this:
Code:
<div class="sidebar-right">
<p><a href="http://www.f1grandprixtours.com/subscribe/"><img src="http://localhost/f1grandprixtours/theme/f1gp/images/subscription-box.png" alt="Subscribe" /></a></p>
</div>

It's pretty straight-forward.

I found this in the components.xml file:
Code:
<item><title><![CDATA[subscribe-sidebar]]></title><slug>subscribe-sidebar</slug><value><![CDATA[&lt;div class=&quot;sidebar-right&quot;&gt;
&lt;p&gt;&lt;a href=&quot;http://www.f1grandprixtours.com/subscribe/&quot;&gt;&lt;img src=&quot;http://localhost/f1grandprixtours/theme/f1gp/images/subscription-box.png&quot; alt=&quot;Subscribe&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;]]></value></item>

When I check the source while the component doesn't show up, I find this there:
Code:
<?php get_component('subscribe-sidebar'); ?>

OK, this is interesting. I just removed the exec-php plugin, and the box disappears from all pages, whether I worked on the content or not.
Reply
#5
are you putting <?php get_component('subscribe-sidebar'); ?> within a page's post, or hardcoded within a template file?
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply
#6
Code:
img src="http://localhost/f1grandprixtours/theme/f1gp/images/subscription-box.png" alt="Subscribe" />

the image is on localhost, the script on a
Code:
http://www.f1grandprixtours.com/subscribe/

?
|--

Das deutschsprachige GetSimple-(Unter-)Forum:   http://get-simple.info/forums/forumdisplay.php?fid=18
Reply
#7
I think it is hard coded in the page.
F1GP
you need to edit your template php file, or another php file that is called every time like footer.php or sidebar.php.
It looks like you may be editing them but from inside the admin panel maybe? Anyway here is something you can try on your header.php

on the style css
Code:
header .subscribe{
here you put the properties you need. margin color, font, float, etc
}

header.php find a spot and put this
Code:
<div class="subscribe">
<p><a href="http://www.f1grandprixtours.com/subscribe/"><img src="http://localhost/f1grandprixtours/theme/f1gp/images/subscription-box.png" alt="Subscribe" /></a></p>
</div>
Reply
#8
Hi,

Thanks for the replies.

@ccagle8, I am trying to use the code within page posts, since I don't want it on every page (I know one could write some code into a function to do this, but I don't have the expertise to do so.)

@Connie, I fail to see why this is a problem. The CMS is on my localhost. It's far from finished, so there's no point loading it. ;-)

@dom, nope, I'm trying to use the code in posts. As stated in my reply to ccagle8, I'm sure this thing could be turned into a function, but I don't know how to do that.

Thanks again for all the replies.
Reply




Users browsing this thread: 1 Guest(s)