awesome. best results I've had from any search situation so far with silverstripe. onbeforewrite and creating a master collection in metadescription was a great idea. Simple but something I didn't think about. I have it working with a few different dataobjects now and multiple page subclasses. Exactly what I wanted. Thanks again.
We've moved the forum!
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
- Previous 10 entries
- 1
- 2
- 3
- 4
- Page 55(current)
- 6
- Next 10 entries
I have one other question which will hopefuly be relevant to other people as it seems a pretty common situation. What happens when the GlossaryTerm is connected to another dataobject through a hasmany or many_many connection? Supposing a GlossaryTerm could have many references, in searchcontext and modeladmin I could add into searchable fields 'MyReference.Title' but with setup it crashes the sql and I get an error such as
[User Error] Couldn't run query: ALTER TABLE "GlossaryTerm" DROP INDEX "SearchFields", ADD fulltext "SearchFields" (.....,....,....,...) Key column 'MyReferences' doesn't exist in table
Is there a fairly simple way to get around this? Thanks again
I am getting a blank page when trying to use this search form.... All I want to do is search one type of DataObject. I have implemented the form in the Page.php. I tried using a simple control in the page template to display results.... is this the right way ?
<% if results %>
<% control results %>
$Property
<% end_control %>
<% end_if %>
Hi lanks
Sorry only just noticed your post. you still working on this by any chance?
If so it sounds like you are missing the template Page_results.ss. I don't see why I shouldn't work in Page.ss though as long as nested correctly.
Heres the markup I have showing my results
<% if Results %>
<ul id="SearchResults">
<% control Results %>
<li>
<% if MenuTitle %>
<h3><a class="searchResultHeader" href="$Link">$MenuTitle</a></h3>
<% else %>
<h3><a class="searchResultHeader" href="$Link">$Title</a></h3>
<% end_if %>
<% if Content %>
$Content.FirstParagraph(html)
<% end_if %>
<a class="readMoreLink" href="$Link" title="Read more about "{$Title}"">Read more about "{$Title}"...</a>
</li>
<% end_control %>
</ul>
<% else %>
<p>
<%-- Example of a translatable string (see http://doc.silverstripe.org/i18n) --%>
<% _t("Page_results.ss.NORESULTS", "Sorry, your search query did not return any results.") %>
<%-- By the way, template comments marked like this will be excluded from the HTML output --%>
</p>
<% end_if %>
Hello, Aram, a question for you:
what exactly changed with this custom search? I ask it cause none of the links work now, but search works fine.
To clerify, I had a LOTDPage where i displayer LOTDs - link of the day.
I made a few functions, one of them being a delete function, the other is a frontend edit function.
Both of them were controlled via link. Also, one of LOTDs was leading to my homepage.
In any case, non of the links works, even for my homepage, and every time i run dev/build it creates a new page called Home. I guess since it is missing that none of my links work and something is messed up. I just wanna know how to fix all that. If you need further clarification I have added all of my files in example, somwhat like what you posted in your original post.
Plz help!
Hi Mac
Not sure sure about the homepage issue, sounds like you don't have one in place though. Silverstripe forces you to always have a homepage I think so even if the navigation name isn't home the url has to be home.
On LOTD.php your link function doesn't do anything
public function Link() {
return DataObject::get_one("LOTDPage")->Link() ."#term".$this->ID;
}
it's calling your LOTDPage then just telling it the term ID but not telling it what to do with it. As a start you need to change in LOTDPage
static $allowed_actions = array(
'ShowTerm'
);
to
static $allowed_actions = array(
'ShowLOTD'
);
and the link function in LOTD to
public function Link()
{
if($Page = DataObject::get_one("LOTDPage "))
return $Page->Link() ."ShowLOTD /".$this->ID;
}
I haven't tested any of this but thats what it looks like on first glance
Hi to all, i am trying to get this thing straightened out: Getting my customs textfields to become searcheabled. I like the simplicity of populating the $Metatags or $Description with text taken from my customs textfields. As those ($Metatags and $Description) are searcheabled, this does the trick. But HOW and WHERE to do that?
I am no PHP expert, but in plain text or back to my ActionScipt 3 days, that would be like this:
$Metatags.text = $Nom.text + $Prenom.text + $Entreprise.text
Where $Nom, $Prenom, $Entreprise are my custom textfields.
I KNOW THIS ISNT IT, but that what i want!
- - -
Any help appreciated.
Thanks!
I wanted to add in my information from some textfields columnOne and ColumnTwo so i used below. You might want to read up a little on PHP classes and objects it will make it a lot easier to understand.
function onBeforeWrite() {
parent::onBeforeWrite ();
if (strlen(trim($this->record['MetaDescription']))<1){
$this->record['MetaDescription']=$this->Content.' '.$this->ColumnOne.' '.$this->ColumnTwo.' '.$this->ColumnThree.' '.$this->BottomContent;
}
}
UPDATED ABOVE
- Previous 10 entries
- 1
- 2
- 3
- 4
- Page 55(current)
- 6
- Next 10 entries