my HTML looks like this:
Link to twitter
In my case, I have 2 diffrent twitter-accounts, an english one, and a german one.
So I thought, i'll check the language the current site, and modify the link:
TypoScript
twitter_link = TEXT
[globalVar = TSFE:sys_language_uid = 1]
twitter_link.value = http://www.twitter.com/myFirstAccount
[global]
[globalVar = TSFE:sys_language_uid = 0]
twitter_link.value = http://www.twitter.com/mySecondAccount
[global]
It simply doesn't work. It always just displays the first given value. It seems like, the conditions are not checked correctly.
I also tried:
[globalVar = GP:L=0]
// do german stuff here
[global]
[globalVar = GP:L=1]
// do english stuff here
[global]
However, if I use something like:
10 = TEXT
10.data = TSFE:sys_language_uid
10.wrap = -- lang-id: | --
It is correct.
A normal check with an if didn't work, or I havn't found any "normal" if's in TypoScript.
Any ideas?
thank you
Your typoscript doesn't have any relation to the plugin.
Should look like this:
plugin.<your_pluginname>.settings.twitter_link = http://www.twitter.com/myFirstAccount
[globalVar = GP:L=1]
plugin.<your_pluginname>.settings.twitter_link = http://www.twitter.com/mySecondAccount
[global]
You can then access "twitter_link" in your controller via $this->settings['twitter_link'].
Related
I have tried three different approaches, to no avail.
First is:
$s = $presentation.Slides[$targetslide]
$tb = $s.Shapes.AddTextbox($horiz,$left,$top,$width,$height)
$tb.TextFrame.TextRange.Text = $fla
the second is:
$f0a = ''
#$f1a is text to insert
$presentation.Slides[$targetslide].Shapes[1].TextFrame.TextRange.Replace($f0a, $f1a)
and the third is:
$s = $presentation.Slides[$targetslide]
$s.Shape[1].TextFrame.TextRange.Text = $fla
Neither seem to work. Do you have any suggestions as to what I should try?
Apparently,
$f0a=$s.Shapes[5].TextFrame.TextRange.Text
$test = $s.Shapes[5].TextFrame.TextRange.Replace($f0a, $f1a)
works perfectly.
I make my first FullTextSearch app. Today I at last began test.
'test'
... the Whig national **ticket** victorious, he ... Democrats who **thought** he was ...
... also a self-**tought** architect. He ... and he always **thought** of how ...
... HTML (Hyper **Text** Mark-up ... Сервер HTML Hyper **Text** Markup Language. ...
... ,0 2. Aiced **test** ratio (Quick ratio ...
... on the first **Tuesday**, after the first ...
'stop'
... ],Elm); OutText(Elm); **Stop**:=False; End; '2 ...
.. a crucial **step** in the ... is an increasingly **steep** maturity-related...
... CHIPSET FEATURES **SETUP** или INTEGRATED ... CHIPSET FEATURES **SETUP** или ...
... Trisetum, Anisantna, **Stipa** и ... многие виды **Stipa**, Stipagrostis), что ...
My config:
source src1
{
type = csvpipe
csvpipe_command = /usr/bin/php /var/www/html/import.php
csvpipe_field_string = title
csvpipe_field_string = content
csvpipe_attr_string = path
}
index test1
{ source = src1
path = /var/lib/sphinxsearch/data/test1
mlock = 0
# morphology = stem_en, stem_ru, soundex
min_word_len = 2
html_strip = 0
}
I commented the morphology string and reload Sphinx, but result the same. It looks like morphology still works for me.
Possibly the biggest thing to look at is
morphology = stem_en, stem_ru, soundex
Morphology is a very powerful function, in that it 'morphs' words going into the index (and in the query, so can match!), using various rules.
In your case you've enabled stemming, which 'normalizes' word endings, BUt auso have soundex, which is a 'sounds similar' algorithm. I believe designed for English, so dont know how well it does on Russian!
All of these means going to get 'similar' matches, not just exact word matches.
(test is just a word that happens to sound similar to other words, your hyper example, is a more unique sounding word)
Also realise its probably jsut a test script, but can pass multiple documents at once to buildExcerpts. So its should be MUCH more efficient, to compile the documents and call buildExcepts just once.
But even more interesting, is as you sourcing the the text from a sphinx attribute, can use the SNIPPETS() sphinx function (in setSelect()!) in the main query. SO you dont have to receive the full text, just to send back to sphinx. ie sphinx will fetch the text from attribute internally. even more efficient!
After the output of keywords in URL, how do I check whether the keywords exist in the content of the page like the content below, if yes then return 1, else return 0. There is strfind at there, but I do not have idea why it cannot work
str = 'http://en.wikipedia.org/wiki/hostname'
Paragraph = 'hostname From wikipedia, the free encyclopedia Jump to: navigation, search In computer networking, a hostname (archaically nodename .....'
SplitStrings = regexp(str,'[/.]','split')
for it = SplitStrings
c( it{1} ) = strfind(Paragraph, it{1} )
end
SplitStrings = {};
feature11=(cellfun(#(n) isempty(n), strfind(Paragraph, SplitStrings{1})))
I can do with the below code 4 checking whether 'https' exist or not. But, how to modify the 'SplitString' into 'B6'?
str = 'https://en.wikipedia.org/wiki/hostname'
A6 = regexp(str,'\w*://','match','once')
B6 = {'https'};
feature6=(cellfun(#(n) isempty(n), strfind(A6, B6{1})))
It is absolutely not clear to me what you want to do here...
I suspect it is this:
str = 'http://en.wikipedia.org/wiki/hostname';
haystack = 'hostname From wikipedia, the free encyclopedia Jump to: navigation, search In computer networking, a hostname (archaically nodename .....';
needles = regexp(str,'[:/.]*','split') %// note the different search string
%// What I think you want to do
~cellfun('isempty', regexpi(haystack, needles, 'once'))
Results:
needles =
'http' 'en' 'wikipedia' 'org' 'wiki' 'hostname'
ans =
0 1 1 0 1 1
but if this is not the case, please edit your question and include your desired outputs for some example inputs.
EDIT
OK, so if I understand you corretly now, you want whole words and not partial matches. You must tell this to regexp, in the following way:
%// NOTE: these metacharacters indicate that match is to occur
%// at beginning AND end of word (so whole words only)
needles = strcat('\<', regexpi(str,'[:/.]*','split'), '\>')
%// Search for these words in the paragraph
~cellfun('isempty', regexpi(haystack, needles, 'once'))
You can try this
f=#(str) isempty(strfind(Paragraph,str))
cellfun(f,SplitStrings)
This should get whole words. The key is parsing the variable Paragraph to get them
SplitParagraph=regexp(Paragraph,'[ ,:.()]','split');
I=ismember(SplitStrings,SplitParagraph);
SplitStrings(I)
In TYPO3 4.5, how can a value stored in $_POST (in a 2-dimensional array) be accessed via Typoscript?
print_r($_POST) looks like this:
I have tried this:
20 = TEXT
20.data = GP:[tx_powermail_pi1][uid1517]
and also
20.value.data = GP:[tx_powermail_pi1][uid1517]
but it doesn't output anything. How is the correct syntax?
You can use GP:stuff|key like so:
10 = TEXT
10.data = GP:tx_powermail_pi1|uid1517
See: http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.5.0/view/1/2/#id1037388
(search for getText)
I use an automation script that tests a browser-based application. I'd like to save the visible text of each page I load as a text file. This needs to work for the current open browser window. I've come across some solutions that use InternetExplorer.Application but this won't work for me as it has to be the current open page.
Ideally, I'd like to achieve this using vbscript.
Any ideas how to do this?
You can attach to an already running IE instance like this:
Set app = CreateObject("Shell.Application")
For Each window In app.Windows()
If InStr(1, window.FullName, "iexplore", vbTextCompare) > 0 Then
Set ie = window
Exit For
End If
Next
Then save the document body text like this:
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("output.txt", 2, True)
f.Write ie.document.body.innerText
f.Close
If the page contains non-ASCII characters you may need to create the output file with Unicode encoding:
Set f = fso.OpenTextFile("output.txt", 2, True, -1)
or save it as UTF-8:
Set stream = CreateObject("ADODB.Stream")
stream.Open
stream.Type = 2 'text
stream.Position = 0
stream.Charset = "utf-8"
stream.WriteText ie.document.body.innerText
stream.SaveToFile "output.txt", 2
stream.Close
Edit: Something like this may help getting rid of script code in the document body:
Set re = New RegExp
re.Pattern = "<script[\s\S]*?</script>"
re.IgnoreCase = True
re.Global = True
ie.document.body.innerHtml = re.Replace(ie.document.body.innerHtml, "")
WScript.Echo ie.document.body.innerText