after porting my fully working SS3.1 Page from my Webserver http://mydomain.de to my locally installed XAMPP http://intranet/silverstripe I've got the problem that the Base Directory is now wrong in SS. It's the old one from the webserver / but it need to be /silverstripe
I already changed it in the .htaccess so that mod_rewrite works but $BaseDir returns / and if I try to use the SS Sitesearch than I get redirected to home/SearchForm?Search= instead of silverstripe/home/SearchForm?Search= after submitting the form.
Can someone please help me to fix this problem.
Thank you in advance
EDIT:
I just call $SiteSearch in my Template.
But the function is modified in my Page.php to search also through a dataobject.
public function results($data, $form){
$results = $form->getResults();
$query = htmlspecialchars($data['Search'], ENT_QUOTES,'UTF-8');
$objects = ListingObject::get()->where("MATCH (Title, Link, Company, Category) AGAINST ('$query' IN BOOLEAN MODE)");
$results->merge($objects);
$data['Results'] = $results;
$data['Title'] = _t('SearchForm.SearchResults', 'Search Results');
$data['Query'] = $query;
return $this->customise($data)->renderWith(array('Page_results','Page'));
}
without this code it also doesn't work
SOLUTION:
I'm sry. I found the Problem. I didn't call $SiteSearch, because when I created the Page, I had to edit the form, so I hardcoded it... because of that, the submitted url is wrong now. I'm so sorry!
$BaseDir should be $BaseHref in your template.
You might have to set an alternate base url in the SS config. Add this to your config.yml:
Director:
alternate_base_url: '/silverstripe'
Related
I would link to create a link to a frontend page inside a backend module.
Using:
<f:link.page pageUid="40" >Link</f:link.page>
Doesn't work. It generates a link to the current backend module.
Any solution ?
Since TYPO3 v9 you can use the following lines of code:
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Routing\PageRouter;
$siteFinder = GeneralUtility::makeInstance(SiteFinder::class);
$site = $siteFinder->getSiteByPageId($pageId);
$router = $site->getRouter();
$frontendUrl = (string) $router->generateUri($pageId);
Thanks to Benni Mack # TYPO3Camp Mitteldeutschland
This is a very long story but the gist is: it is not possible to create FE links in BE/CLI context without a lot of workarounds and dummy objects/values.
If possible you should use solutions like pagepath which generate URLs for an eID script which performs the actual URL generation on demand.
I have existing Firefox session with appropriate login data to interesting site. Now I want to use it with Selenium and Perl.
I am using this code:
my $driver = Selenium::Remote::Driver->new;
$driver->get("http://www.google.com");
$driver->find_element('q','name')->send_keys("Hello WebDriver!");
print $driver->get_title() . "\n";
But this code opens new blank session of Firefox.
How can I use my existing session with already set up cookies?
You want to specify a Firefox profile to use.
In Java, it'd be something like this...
ProfilesIni profile = new ProfilesIni();
FirefoxProfile firefoxProfile = profile.getProfile("Default"); // might need to switch this around depending on what it actually is named.
WebDriver driver = new FirefoxDriver(firefoxProfile);
(credit to this answer for the pseudo-code)
I think you can try with this option in perl driver.
my $handles = $driver->get_window_handles;
$driver->switch_to_window($handles->[1]);
$driver->close;
$driver->switch_to_window($handles->[0]);
I didn't use it, but may be it will help you!
For more information, please refer to this site.
https://metacpan.org/pod/Selenium::Remote::Driver
Just started learning PHP today. And though I moved through most of my problems quickly, I got stumped with this one.
I have a main page page.php with a dynamic require_once to pull up content. I got the main part working, which is page.php?id=1 page.php?id=2 etc load just fine, but if somebody goes to just page.php without the ID, then there are errors that ruin the page. Now I figured out how to repress the errors with an # and I can also obviously set the links to the page to page?if=default, but I really need a solution to having page.php load content specific to it without errors. Or, perhaps, automatically redirect page.php to page.php?id=default should no id be provided.
The code I current am using for the require_once is:
<?php require_once('folder/' . $_GET['id'] . '.html');?>
Thank you for your help!
Well easiest way would be to check if you have an ID and if not, than just set default one, something like that:
$default = 1;
$id = ($_GET['id'] && is_numeric($_GET['id'])) ? $_GET['id'] : $default;
require_once('folder/' . $id . '.html');
the thing is these this lines:
$loginUrl = $this->view->url(array('controller'=>'auth', 'action'=>'index'));
$registerUrl = $this->view->url(array('controller'=>'register', 'action'=>'index'));
based on rob allens' Zend_Auth login/logout tutorial (win7/apache),
are placed in a view helper, and this one:
echo $this->url(array('controller'=>'index','action'=>'add'));
is placed in the index view script.
The generated links Do work fine in LOCAL, but in REMOTE only the 3rd line works.
ANY IDEAS? Where should i look for this? wich way to follow?
I was tempt to think in the remote server conf but the 3rd line works fine, so..
thanks!
Try this helper instead of view Zend_Controller_Action_Helper_Url:
//simple($action, $controller = null, $module = null, array $params = null)
//so your lines will look like:
$loginUrl = $this->_helper->url->simple('index','auth');
$registerUrl = $this->_helper->url->simple('index','register');
P.S. your lines work properly on Win7 and Ubuntu servers check registry of the lines
I found out that was the server. (.htacces and mod_rewrite) was not included in the package.
I think the third line was working because it was in the index controller, but when calling the others, then happened the object not found.
To work out this, i found an example using zend debug (was in german) so i inferred it (and then wrote to the hosting service), but still not quite sure how to check (phpinfo?) if a host have this features available or not in your package.
I've just created an eID in Typo3. I can't figure out how to access the config data for my plugin from the Typo3 instance.
I've tried the code from the link but it doesn't want to work. I keep getting an exception "No TypoScript template found! " on the call " $TSFE->getConfigArray(); "
http://lists.typo3.org/pipermail/typo3-dev/2006-December/021392.html
Any ideas?
Thanks.
In eID mode, only a small part of the regular TYPO3 frontend is loaded. Unfortunately TypoScript is not loaded. To still access the TypoScript configuration you need manually load the components it needs to do so. Unfortunately this can be a bit of a pain in the butt. So in some cases it might be easier to just load a page containing a single plugin that doesn't contain anything else (without headers etc.).
If you do want to load the TypoScript templates yourself, you can try something like the following:
require_once(PATH_tslib.'class.tslib_fe.php');
require_once(PATH_t3lib.'class.t3lib_userauth.php' );
require_once(PATH_tslib.'class.tslib_feuserauth.php');
require_once(PATH_t3lib.'class.t3lib_cs.php');
require_once(PATH_tslib.'class.tslib_content.php') ;
require_once(PATH_t3lib.'class.t3lib_tstemplate.php');
require_once(PATH_t3lib.'class.t3lib_page.php');
$TSFEclassName = t3lib_div::makeInstanceClassName('tslib_fe');
$id = isset($HTTP_GET_VARS['id'])?$HTTP_GET_VARS['id']:0;
$GLOBALS['TSFE'] = new $TSFEclassName($TYPO3_CONF_VARS, $id, '0', 1, '','','','');
$GLOBALS['TSFE']->connectToMySQL();
$GLOBALS['TSFE']->initFEuser();
$GLOBALS['TSFE']->fetch_the_id();
$GLOBALS['TSFE']->getPageAndRootline();
$GLOBALS['TSFE']->initTemplate();
$GLOBALS['TSFE']->tmpl->getFileName_backPath = PATH_site;
$GLOBALS['TSFE']->forceTemplateParsing = 1;
$GLOBALS['TSFE']->getConfigArray();
$cObj = t3lib_div::makeInstance('tslib_cObj');
This initializes the TSFE and cObj but is also used to load and parse the TypoScript templates. You might need to make some modifications to (probably kick some things out)
The code came from one of the comments on the following blog post: http://sebastiaandejonge.com/blog/articles/2010/september/21/bringing-ajax-to-your-frontend-plugins/
Good luck!